cleanup debug so it works on json