Port the changes from contao/core@173b9d4bf5bb2f0199a48ddb654ab96b4048026c