fix tests and typo bugs