Port the changes from contao/core@b0be9fdce6cc05688f5d2ae47a11170b88d70a35