Fix bug with isDirectory()