fixes backported from other projects