Fix bug in gradient definition.