parent_id pre-counting fixed