there is an error in this function. It is not reinitializing string->len.

I have fix it and improve the api test-suites so it would have caught the problem.

new commit coming soon