Replacement for core Tweaks and fixes

Fixes the #6110 ;
@claudiosmweb I have manged this changes with single PR.