Backport fixes from git-lantern, add a new one.
Merge branch 'master' into git-lantern