fix possible memory leak