Fixed problem with memory