BUG: Gradient Pattern Function Is Incorrectly Calculated