Fix a bug in gradient sprite UDP
Code cleanup