Cleaning up code and fixed a bug, now scheduler will find out if it's in the middle of the cycle and will enable task rather than wait till next start cycle