Fix the directory checking.