before leave redirecting to home