fix bug and directories count