removed dirty hack. Replaced it with dynamic_cast