Fixed many bugs with login