Port the changes from contao/core@cd66d61d3d1aa25294808fbede392d4fecc93cc2