Fix problem with the api and sessions

Fixes #18