Hi,
Not sure this is the same problem but I have a custom template designed by Auctiva years ago. It was initially set up for four images. Everything is fine as long as I use exactly four images. If I add more than four, everything goes haywire. I remember when they designed the template they asked me how many images I would use so there must be something in the HTML design that is affected when I change the number of images. Maybe something in your custon templates is similar. Not sure but good luck.