Fixed bugs identifieed by go vet