Fixed memory management bug.