Port the changes from contao/core@800ed2db8fdd97f17a3a228c488a37c4a0d06665