Fix a memory bug