Fixing lookup in loop and color gradient