fixing file/dir existance checking