moved the condition for substracting the residue to Im(za)>0 and Re(w)>0 [instead of Re(za)<0]