improve test coverages, refactor accordingly.