Fix bugs for registration/login