trying to fix the waiting in scheduler