Port of !379 (merged) from run2-patches to master.
@erodrigu - slightly later than promised, but here it is.