Fix issue #1.

Also refactor the unittest to prevent possibility of such issues.