Fixed a possible null pointer exception in FileIO