implement preemptive scheduler, fix bug on task return