fixed bug where session was not stored at the end of a request if it had just been created