fix bugs and update Upgrader