basic fixes for ext/json
finer fixes for ext/json