[2.5.x] Backport #3454 against 2.5.x branche

See here for the orginal Tracker:
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33619&start=0
and here for the based pr aginast staging by @demis-palma:
https://github.com/joomla/joomla-cms/pull/3454