fix hsp calculation