File handling fixes

Although Karin indicated that these changes had already been incorporated into a version worked on at the sprint, here's a formal PR nonetheless.