Fixing IOError exception catching bug.