Add proper cast to eliminate size mismatch warning

I got tired of seeing the warning every time I compiled an example.