Change the location of the local variable buf.
Fix for Psych YAML engine. Sych YAML engine has been removed in ruby 2.0.0.