Tweaks to file handling