Port the changes from contao/core@1dfb1649301a3e40723b781e59e02faeb8382402