Corrects bugs remaining of the last rerefactoring.