fix if file exists instead of dir exist