Fix #335 Scheduler stops a program at the beginning of the event if (onBegin=false and onEnd=true), stops at the end of the vent if (onBegin=true and onEnd=true)