Reduce the number of warnings by adding some casts.