Fixed a problem exposed by tests.