repair some bugs