[Yaml] Fixed #6770
[Yaml] Updating #6772 to be more consistent with existing code.