tests + bugfixes for session