fixed issues with JSON parsing