bugfix
Worked once for index build & single end (plus, found a bug in the old code & fixed it)