Fix error handling to work with Go 1.0.