corrected mistakes in except block