Fixing bugs introduced in the refactoring.