Fix some memory leakage