make sure we get a proper File object or an error
Merge pull request #1655 from Remo/patch-66

make sure we get a proper File object or an error