same fix in gradient from S