improve barrier demo