Fixed unnecessary iteration for non terminated strings