fixed bugs with session