Port the changes from contao/core@a2a869a8bfd3d9cc9347867576b22da3ee13e9d0