Fixed bugs in try/except blocks