Fixing problems around invalid user_id in session.