remove redundant dynamic_cast