use dynamic_cast instead of query_interface