Thanks Phanx. That first code change fixed the errors (for some reason, it didn't like the more compact version, but I don't mind the extra code as long as it works).
Now I just need to change my show on combat scripting so that it doesn't spawn the panel at all if the addons for it are not present. I will try making it dependent on the addon first, if that doesn't work, then I simple if then should do the trick. I might be back though, if I can't get it sorted