Backport fixes from git-lantern, add a new one.