Update and repair some bugs.