code from jyaml 1.3