onLeave and onEnter work