removing memory leakage