Added EnsureTaskScheduled method