Fix register with 0 item problem
Fix problem with directory reading