changed c cast to static_cast