fixed a bug where an exception was being thrown erroneously after certain file io commands