Bug fix and enhancement cherry-picks from precise branch