Important memory bug fix