getWidthAndHeight was being called twice for each ad placement: once when setting the size of the div, and once when calling the defineSlot API. getWidthAndHeight always advances to the next size in the list, so the wrong size ad would be inserted into the div.