replaced c-style casts with static_cast