Fixed bug in pthread barrier code