Add memory barriers