collapse the identical leaves again