I have a UIDropDownMenu for users to set an option in my addon. I initialize the drop down menu with the following code:

Code:
function IP_BuildLimitDropdown()
	local info = UIDropDownMenu_CreateInfo();
	info.text = "1";
	info.value = 1;
	info.func = IP_LimitSelect;
	UIDropDownMenu_AddButton(info);
	info = UIDropDownMenu_CreateInfo();
	info.text = "2";
	info.value = 2;
	info.func = IP_LimitSelect;
	UIDropDownMenu_AddButton(info);
	info = UIDropDownMenu_CreateInfo();
	info.text = "3";
	info.value = 3;
	info.func = IP_LimitSelect;
	UIDropDownMenu_AddButton(info);
end
I store the value the player selects in a saved variable and then when they press the button to open up the options window I have the following code:

Code:
InstanceProfits_RecentHistory:Show();
InstanceProfits_RecentHistory:SetFrameStrata("HIGH");
InstanceProfits_RecentHistory:Raise();
UIDropDownMenu_SetSelectedID(InstanceProfits_RecentHistory_LimitDropDown, recentLimit);
However, when I first open the frame the text in the drop down box says "Custom" which isn't even an option in the list. If I click on the drop down box it shows the correct selected value and immediately updates the text. I get the same result if I change SetSelectedID to SetSelectedValue or SetSelectedName.

Is anybody familiar with this behavior or can tell me where I'm going wrong? The on click handler appears to be working correctly, and it uses similar code:

Code:
function IP_LimitSelect(self, arg1, arg2, checked)
	if not checked then
		UIDropDownMenu_SetSelectedValue(InstanceProfits_RecentHistory_LimitDropDown, self.value);
		recentLimit = self.value;
		IP_ShowRecent();
	end
end
So I'm thinking the problem has to be somewhere around where I initialize the drop down, but I'm not sure where.