Fixes to JSON parsing