add check for dirName is file. fixes #265