fix check for is directory