add error.go and modify some methods