Fix several bugs regarding login verification