Port the changes from contao/core@bb5d9b12b448fe0d1c38d8759d58a37b135616ac