fixed hsb algorithm