Merge "Set unused reference frames to first ref" into main