Fix bugs in creating networks from JSON.