I though the isDirectory function already return a boolean