Fixed another waitFlush issue in library