Fix some bugs in install.go.

See the commit messages for more details.