fix bugs and typo