Minor cleanup in session hook