Merge #3209 and 2.10.x to master

Review by @dotta

This is a superset of #3227