keeps user logged in but page is loading twice