fix backported from HEAD