Copy over node buffer tests

These patches pull in node's buffer tests and make the changes required to pass them.

This includes a proper fix for #48 /cc @trollixx.