Fix code that triggers go vet errors

There are a few places in the code which are triggering errors when running "go vet" so this pull request should fix all those.