Fix some reference errors not caught in tests.