Remove more unnecessary dynamic casts