network: revise code logic