Fix session issues with unit tests