Fixed some session bugs