Sync with upstream

Merging latest commits from upstream, including Scott's changes to allow interal to work in :object mode.

CC: @camilo, @csfrancis