fixed polymorphism bug