fix buffer.toJSON method in Firefox 18+