Fix case when schedule runs twice because it takes too long time to execute