This sort of thing is quite common for non-native speakers. The fact that you can say "how does X work" and "how X works" but not "how does X works" is not particularly obvious, and easy to mix up.