fix bugs for working register and login methods