memory cleanup fixed