removes extra newline char with terminate call