fixed a few bugs for Login