Fixed problems with memory.