Fixed bug in session handling.
Merge branch 'test' into dev