Odds are your video card can only output correctly to the TV at 2 or 3 resolutions -- probably 640x480, 800x600, and (maybe) 1024x768. When trying to find a good resolution, Mame tries some other oddball ones, like 400x300 (or much lower if you are using DOS mame, but I am assuming you aren't) and these don't display right because the video card wasn't designed to handle them (not for TV out, anyway). However, if you are using hardware stretching, it doesn't really matter much what resolution you use, the games will come out about the same (with some exceptions -- vector games look better at higher resolutions, for example).
Mame does a series of calculations to decide what resolution to use. Odds are that for the games that are fitting correctly, it is using 640x480, so setting it to use that for ALL games probably won't be a problem. If it is, then just use the switch on a game-by-game basis (I haven't used MameWAH, but I'm sure it lets you set this).
-Jeff "etumor"