Fixed bugs found by re-running tests.