bug in leave and enter