Backport tiny changes that help supporting opal