Port the changes from contao/core@694097190d44819e4dc5f5f77393fc2f6b134978