Add asserts for isFile and isDir.