Port the changes from contao/core@b2a46447b71adaf11a161250b1adcff87d591212