fixing issues with session handling