more json fixes and tests