Update net.cpp

Fixed bug raised by @tdomhan in issue #100.