Make invokeEncoder play nice with polymorphism.