Fixing memory allocation.