Migrate the rest of the tests; fix resulting bugs.