lib: Fix tests and monkeypatching for Node 0.8.x.