memory allocator and code correction