Respiratory motion induces discrepancy between the expected tumor positions used in treatment planning and the actual positions during treatment delivery. Such motion degrades greatly the effectiveness of the radiation treatment. To address this challenge, we have proposed an online treatment failure detection approach with image guidance. Tumor motion is tracked in real-time during treatment delivery and compared to the baseline motion used in treatment planning. Tracking errors are recovered online with subdivided subsequence correlation. A stop-n-wait dose delivery procedure is applied to minimize treatment errors. Two approaches have been developed to address baseline shift in tumor motion. The performances are evaluated using three different metrics: the misplacement of the tumor, the treatment efficacy, and the intervention frequency. The results showed that the new approaches will reduce treatment errors, improve dose delivery efficiency, and reduce treatment interventions. This study has the potential to be employed in clinical practice thus improving radiation outcome.