Fix bugs arising from joomla code #29922

(PR #959).

http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=30833