add barrier,
fixing bugs.