simplified isDir valdiator logic, fixed isDir test error