Fixed session bugs