Fix for infinite loop during network construction