few JSON fixes and tests