Sarina/annotations fixes

@adampalay 

Cherry-picks commits from #4796 and #4823 (once that one is good to go)