get rid of dynamic cast to stop seg fault