fix a bug add sync in marking outputs