Cherry-pick ALOY-1053 fix from master