Fix/cherrypicked

cherrypicked fixes from the resting PR.