Rewrite so that buffer.js is not needed if a global default is provided
Fixed undefined property set