fix isDirectory bug