fixed string termination bug