Fixed bugs in sessions