remove a couple of dangerous dynamc_cast