fix bug with wrong counting children