Fix polymorphic bug