Merge touch-ups and fixes for #9831 (+port fix to packaging) and #9223 from 3.2