Fix barrier implementation