lots of json fixes