Refactor read.go and make more fail-safe