Fixes to UA code so that it worked in all versions of Magento.