Fix buf is undefined in IE

IE just will find the `buf` as a property of `locals` but will not to find it in the upper context.
Merge pull request #132 from iwillwen/master

Fix buf is undefined in IE