fix the if check for logged in