Fixes #1749. Fix CPGradient error introduced by 08ad614.