Add more unittests.
Fix errors.
Fix bug.