debugging the memory bug