Handle files without meta data correctly.

Here file.flags is NoneType which you cannot access.