Small fixes to file operations