detect if the file exists. fix #17