fix directory as file opening