JS login bug fix