Fixed rebase bugs and other bugs.