Better fix 

Source (https://github.com/joomla/joomla-cms/pull/3248)