Backporting changes from 1.5.1-onshape.