improve session mechanism.