Evaluating definite integral - Let's say we want to evaluate $$ \int_0^{2\pi} \frac{1}{a^2\cos^2x+b^2\sin^2x}dx$$
With substitution, one obtains $$ \frac{1}{ab} \arctan\left(\frac ba \tan x\right) $$
as antiderivate. For more details on how to do this, see this question.
Now my question is, why do I receive $0$ if I insert $0$ and $2\pi$ as integration bounds ? This obviously can't be true since the integrand is always positive. 
What do I oversee ? 

Notice, the property of the definite integral $\int_{0}^{2a}f(x)\ dx=2\int_{0}^{a}f(x)\ dx\ \ \ \  \ \  \forall \ \ \ f(2a-x)=f(x)$
$$\int_{0}^{2\pi} \frac{1}{a^2\cos^2 x+b^2\sin^2 x}\ dx$$$$=2\int_{0}^{\pi} \frac{1}{a^2\cos^2 x+b^2\sin^2 x}\ dx$$ $$=4\int_{0}^{\pi/2} \frac{1}{a^2\cos^2 x+b^2\sin^2 x}\ dx$$
$$=\frac{4}{b^2}\int_{0}^{\pi/2} \frac{\sec^2 x}{\left(\frac{a}{b}\right)^2+\tan^2 x}\ dx$$$$=\frac{4}{b^2}\int_{0}^{\pi/2} \frac{d(\tan x)}{\left(\frac{a}{b}\right)^2+\tan^2 x}$$
$$=\frac{4}{b^2}\frac{b}{a}\left(\tan^{-1}\left(\frac{bx}{a}\right)\right)_{0}^{\pi/2}=\frac{4}{ab}\tan^{-1}\left(\frac{\pi b}{2a}\right)$$
