Port the changes from contao/core@c62153797f5840793750a44352210b1f9ebbfc0f