Resolved problems with memory allocation