Fixed some bugs with scheduler!