Fixed bug in network encoder