Backport #3459 into 2.5.x

Backporting #3459.

See this Tracker
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33620&start=0
and this pr against staging
https://github.com/joomla/joomla-cms/pull/3459

thanks again @demis-palma