Improve program flow.

go vet .
util.go:80: unreachable code
This func is still not completely right and needs to be fixed. Consider that the success case, where it's supposed to return number of bytes written and nil error. That never happens.