Add explicit casts to eliminate compiler warnings.