In Atiyah's commutative algebra, exercise3.21(ii) is the following: Let $f:A \to B$ be a ring homomorphism. Let $X=Spec(A)$ and $Y=Spec(B)$, and let $f^* : Y \to X$ be the mapping associated with $f$. Identifying $Spec(S^{-1}A) $ with its canonical image $S^{-1}X=\{ p | p \cap S = \emptyset \}$ in $X$, and $Spec(S^{-1}B)(=Spec(f(S)^{-1}B))$ with its canonical image $S^{-1}Y=\{q|q \cap f(S) = \emptyset\}$ in $Y$, show that $(S^{-1}f)^* : Spec(S^{-1}B) \to Spec(S^{-1}A)$ is the restriction of $f^*$ to $S^{-1}Y$, and that $S^{-1}Y=f^{*-1}(S^{-1}X)$.
I solved the above problem, but I have a question. In the case of $S=A-p$, then we can reduce $f^*$ to $S^{-1}Y \to S^{-1}X$. But in another problem(Ex5.10(c')), textbook says that $f^*$ reduces to $Spec(B_q) \to Spec(A_p)$ where $p=f^{-1}(q)$. Then the codomains are same(up to isomorphism), but the domains seems different. $S^{-1}Y$ is the set of primes that are disjoint from $f(S)=f(A-p)$, and $Spec(B_q)$ is the set of primes contained in $q$. But I think that the latter is correct since q' \subset q implies f^{-1}(q') \subset f^{-1}(q)=p. What is the problem?