better handle edge cases around file IO