improved string termination