fixed newlines and realloc in buildstring