added correct checking for file exsist