backport from libyaml-1.1.6