add barrier and tests