Fix a bug discovered with the integration test.

* The bug was introduced in the recent refactoring.