Fix JSON reference counting errors