Added pointer check while debugging polymorphism issue