schedule function fix