Replaced all dynamic casts by reinterpret_casts.