Port the changes from contao/core@ffebae9624d13d1523e0ca93cbf93a166771f1d9