modified to mormalize a file path in isDir(), and isFile().