fixing bugs with sessions