Adjust casts to avoid warnings.