apply patch from HGS to fix and improve suffix array