Fixed bug with leaf state.