Fixed the isDirectory method