fix memory barriers in atomic operations