Fix "wait before marking" synchronization bug