Port the changes from contao/core@7e91b644ce2a25ac04f0490f3c67286e2a3e37c3