Login code bug fix