Fixed race condition in API event()
Fixed race condition in API addHandler()
Fixed race condition in API schedule()