fixed checkLogin function (hopefully)