Fixed mistakes in the net util.
Added better cleanup to the net util.