Corrects substring handling in sequence match fix #4