Your function which scans backpack wont work correctly. There are two issues: slotIndex starts with 0, and you should be scanning all bag slots not just numUsedSlots. It is because not all slots are full.
Lua Code:
local name
local itemName
local count
local bagId = BAG_BACKPACK
local numSlots = GetBagSize(bagId)
for slotId = 0, numSlots - 1 do
itemName = GetItemName(bagId, slotId)
As for the UI error - how is your addon manifest look like? It seems that you use LootManager in your XML for top level window. If xml file is listed after lua file in the addon manifest, your LootManager table defined in lua will be overwritten by the top level window defined in xml.