testing and debug

solve the problem that when a treatment is finished it will still wait
the offset to trigger next treatment