Guard against session ID conflicts

The chances of this happening should be quite small, but add an explicit check anyway