Some minor improvements related to sessions