bug fix to handle "path not found" case, and add testcase.