replace deprecated shared_dynamic_cast (fixes #25)