fix bug: string realloced while still in use