Added some file checks