fix for index of bounds in lcs