Fix bug in chained strings matching