Repair some errors