Fixed login problem on refresh