Better checking of invalid sessionIds