Fix enter/leave behavior