added try/catch on a dynamic cast

in static cast();