fixed the waiting issue