adjusted the check for the existence of a path for files