fix bugs on last commit da2820d9643f20ebf5f64936e7e4c2f8b18ef1eb