fix problem with memory