Fixed issue with directory iterator