enhance tests, fix bugs.