add fallback to reinterpret_cast if dynamic_cast fail
add fallback to reinterpret_cast if dynamic_cast fail