Fix bug 3781, bad namespace resolution caused by a refactoring blunder