Minor fix in scheduler

Minor change in transformer in order to avoid race condition. 

@peterbourgon