fixed memory leak caused by empty strings