Port the changes from contao/core@6e18dc60d0ea3f896aa7e7c45085cbb8f115454d