fix shared memory allocation