Some more fixes and tests.