Fixed bugs with register and login