Fixes for hsl algorithm