I have been reading the paper of Cox, McKay and Stevenhagen "Principal Moduli and Class Fields", http://arxiv.org/pdf/math/0311202v1.pdf, and I have a question regarding the nature of the function field for $X0(N)$: if I have a modular function for $Γ_0(N)$ that has a rational $q$-expansion at $\infty$, does it follow that $f∈\mathbf{Q}(j,j_N)$?

Allow to me to elaborate on some discoveries I've made reading the above paper, and playing with sage:

I understand that the function field over $\mathbf{C}$ for $X_0(N)$ is $\mathbf{C}(j,j_N)$, and that the $\mathbf{Q}$-function field given by $\mathbf{Q}(j,j_N)$ defines the curve $X_0(N)$ over the rationals. Thus, any modular function for $\Gamma_0(N)$ can be written as rational function in $j$ and $j_N$.

Now, for the case of level $N=1$ modular functions, it is stated in the paper that if $f$ is a modular function that has a fourier expansion at $\infty$ with rational coefficients, then $f$ in fact lies in $\mathbf{Q}(j)$, which seems intuitive. However, I have recently discovered that the analogous fact does not hold for modular functions for $\Gamma_0(N)$ that have a rational fourier expansion at $\infty$. Using a paper of Maier, I have been able to play with the hauptmoduln for $\Gamma_0(N)$ when the group has genus zero. These functions have rational $q$-expansions, but don't necessarily lie in $\mathbf{Q}(j,j_N)$. Indeed, using the function $t_2$ in his paper (a hauptmodul for $\Gamma_0(2)$ that has rational $q$-expansion), I computed that $$t_2(1/4\sqrt{-7}−1/4)$$ is an algebraic integer of degree $2$. In particular, it is definitely not a rational number. On the other hand, the theory of complex multiplication ensures that both $j(1/4\sqrt{-7}−1/4)$ and $j_2(1/4\sqrt{-7}−1/4)$ are integers. Therefore, $t_2$ cannot lie in $\mathbf{Q}(j,j2)$, since otherwise $t_2(1/4\sqrt{-7}−1/4)$ would have to be rational as well.

What is troubling about this fact is that, in the paper of Cox et al., it is stated that if $f$ is a modular function for $\Gamma_0(N)$ and if $\tau$ is an elliptic point of order 2 for $\Gamma_0(N)^\dagger$, but not one for $\Gamma_0(N)$, then $f(\tau)$ must lie in the maximal abelian extension of $K=\mathbf{Q}(\tau)$ and that this follows from basic complex multiplication theory. Now, if it were the case that $f\in\mathbf{Q}(j,j_N)$, then I'd be happy to believe this, but I've just seen that this is not the case. Therefore, I don't see how basic complex multiplication theory says anything about the nature of $f(\tau)$ in this case.

Lastly, as mentioned above, it is stated explicitly that for level $N=1$, we do know that such a modular function with rational $q$-expansion must lie in $\mathbf{Q}(j)$. Does this result remain true for $X_0(N)$ when it has genus zero? That is, after fixing a hauptmodul $h$ with rational fourier expansion, so that any modular function for $\Gamma_0(N)$ can be written as a rational function in $h$, is it true that those functions with rational $q$-expansions can be written as a rational function of $h$ with coefficients in $\mathbf{Q}$?

If anyone can shed some led on any part of this problem, I would very much appreciate it!