Fix a few assertion errors when using files