fix shared variable with a volatile