Fixed bug on login with cookie