Fix a bug: test whether the file exist