Fix a runtime error in dynamic protocol dispatch