made scheduler threadsafe again