repair some errors