Integrating dx/( a+b sin(x))



I was trying to do

 integrate( 1 / ( a+b*sin(x) ), x)

and I got this:
(2.0*atan((0.5*((2*a*sin(x))/(cos(x)+1)+2*b))/(a^2-b^2)^0.5))/(a^2-b^2)^0.5
But if I evaluate this from 0 to 2pi (I was trying to get the Laplace
transform of the zeroth Bessel function) I get some weird stuff.

So I evaluated first from 0 to pi and got this:

(%o47) (1.0*%pi)/(a^2-b^2)^0.5  -  (
2*atan((1.0*b)/(a^2-b^2)^0.5))/(a^2-b^2)^0.5

And then from pi to 2 pi, and got some weird question again (what should
answer to:  33102*%pi*false-103993"  positive, negative, or
zero?"positive;)

So if I integrate from (pi+0.00001) to (2 pi - 0.00001), I get this:

(%o82)
(2*atan((1.0*b-4.9999999999748384*10^-6*a)/(a^2-b^2)^0.5))/(a^2-b^2)^0.5-(2*atan((1.0*b-199999.9834474549*a)/(a^2-b^2)^0.5))/(a^2-b^2)^0.5

Assuming (199999.9834474549) goes to infinity and
(4.9999999999748384*10^-6) goes to zero, and then adding (%o47) and (%o82),
I would then get the correct answer :  1/ (a^2-b^2)^0.5.

So I must bias pi and 2 pi a little bit in order to get the correct answer.
Is this a bug ? How can I solve problems like these in the future without
losing much time finding out where is maxima failing?