fix IOError exception