Add a unit test and fix some generator issues.