add file existence check