loop issue resolved when user is not logged in