Fixed bug when entering/exiting