check for dir not file