Fix hue calculation; hue wraps around