Fix bugs introduced in recent refactorings