I have not been able to figure out how to keep simulary named images from showing up on the wrong product page. I do not want to turn off extra images. Here is an example

CPB-403M3.JPG
And
CPB-403M.JPG
are two different products.
When viewing product CPB-403M, the image for CPB-403M3 also shows up.

What logic must I apply to prevent this?