Works with memdown in node.js

These changes were necessary to make the leveldb backend work with [memdown](http://npm.im/memdown) on leveldb. See the commit comments for some concerns I have about this exact implementation.