fixed bug with using shared memory