* fix python 3.x str.decode exception * Moved try clause inside the if statement * Moved try clause inside the if statement