adds file existence check