fix leak of memory