problems with memory - fixed