Fixed a bug where one leaf is left