Add some unit tests; fix #74.