Merge "replace refset with std::set and fix crashes" into idea133