Resolves some memory leakage.