Adding tests, and fixing an issue revealed by the tests