Session tests and minor fix