Change the order on leave and enter hooks