Fix bug with directory checking.