Port the changes from contao/core@bf022639eff48b2e06161c2230c00b5edd4dac11