Fixed bug with using shared memory