Fixed memory leakage