a number of changes to get sessions working