While the ten-dimensional type IIB supergravity action evaluated on AdS5 x S5 solution vanishes, the five-dimensional effective action reconstructed from equations of motion using the M5 x S5 compacti-fication ansatz is proportional to the AdS5 volume. The latter is consistent with the conformal anomaly interpretation in AdS=CFT context. We show that this paradox can be resolved if, in the case of M5 x X5 topology, the ten-dimensional action contains an additional 5-form-dependent "topological" term f F5M perpendicular to F5X. The presence of this term is suggested also by gauge-invariance considerations in the Pasti-Sorokin-Tonin formulation of type IIB supergravity action. We show that this term contributes to the ten-dimensional action evaluated on the D3-brane solution.