Add a unit test, minor fix