turn implicit integer conversions into static_casts to avoid -Wconversion warnings