using static_cast instead of C-style cast