Fix test failures
make toJSON() use node 0.12 behavior; make test reliable