handle network or io exception, fix merge bug.
refactor.