fix bug in barrier while in loops
ok in canneal