Fixing some stuff in scheduler_dequeue()