fix bug in fileexist func