Update of #2466 against staging branch

This is a new PR for #2466 to be against the staging branch. 
Original JC issue: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=25225&start=0

Thanks @yireo!