fixed memory leaking