Fix for data corruption while writing to shared memory
Fix for data corruption while writing to shared memory