Fix some faults and finish the json printer