fix bugs pointed out by go vet