Port the changes from contao/core@f3bf1a4df5b041d4a6ee9704ca5770c7193032ef