Fixes #2759. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5570053
Fixes #364. R=ken2 https://golang.org/cl/164092