Fix bug on too many leaves in a row.