Fixed possible crash because of race conditions on modifying constants in shared memory