Added a memory barrier but still didn't solve it