Finally fixed the scheduling bug.