Fixed memory leakage bug