Fix a number of miscellaneous draft v3 bugs and add new unit tests.