fix possible mem leak