Corrected string termination problem