Fix destroy, and add tests.