Fixed bug with concurrent access to shared memory