fix slice out of bounds errors.
switch to plain weight - not taking the match length into account