Fixed location of decrefs.
Made reader properly init maps and writer check json_dumps' return value.