fixing bug in checking whether a user is logged in or not.