Fix #31197 for Joomla 2.5

Original Joomla 3.x tracker: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=31197

New tracker for this item: 
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=31988&start=0