Fix and add tests for JsonPatch