Fixed session by converting toObject