Port the changes from contao/core@1b2c4fb11398331aca23807e1ec017cfeb9d7afc