Fixed error in except statement