add isDirectory and isFile function