Fix the polymorphism issues in tests