fixed a bug in converting RGB to HSV