Port the changes from contao/core@468634c5a8b279f68a2cc24ee7bdb175415545bd