Ensure that a session id is generated if none given.

Fixes #25