Fixed a bug that autologin didn't happen after registration