Session fixes + unit tests