How to show $M_{\mathfrak q}$ is flat over $A$ Let $f:A\rightarrow B$ be a homomorphism of commutative rings, and $M$ a finite $B$-module. If $a\in A$ and $M_a$ is a free $A_a$-module, then for a prime ideal $\mathfrak q$ of $B$ with $f(a)\notin\mathfrak q$, how to prove that $M_{\mathfrak q}$ is a flat module over $A$ ?
 A: Note that $M_a$ is free over $A_a$ implies that $M_a$ is flat over $A_a$ since free modules are flat. Since $A_a$ is a flat $A$ module (exactness of localization), we get that $M_a$ is flat over $A$. Now, $M_a = A_a \otimes_A M = A_a \otimes_A (B \otimes_B M) = (A_a \otimes_A B) \otimes_B M = B_{f(a)} \otimes_B M = M_{f(a)}$. Thus, $M_a$ is a $B_{f(a)}$-module. Then consider the ring map $A \rightarrow B_{f(a)}$ (this is the composition $A \rightarrow B \rightarrow B_{f(a)}$). Since $f(a) \notin \mathfrak{q}$, we get that $\mathfrak{q}B_{f(a)}$ is prime in $B_{f(a)}$. Let $\mathfrak{p}$ be a prime in $A$ such that $\mathfrak{q}B_{f(a)}$ lies over $\mathfrak{p}$. Then it suffices to show that $M_{\mathfrak{q}} = (M_a)_{\mathfrak{q}B_{f(a)}}$ is flat over $A_\mathfrak{p}$ (because $A_{\mathfrak{p}}$ is flat over $A$).
This latter assertion is shown in http://stacks.math.columbia.edu/tag/00HT part $(6)$. (Apply $(6)$ taking $R = A$, $A = B_{f(a)}$, $M = M_a$, where $R$, $A$, $M$ are the symbols used in part $(6)$)
