fix left and right children index count