fixed errors with directory method