fixed Bug that it crashed when calling schedule function

fixed Bug that it crashed when calling schedule function