Fix exception in NetworkEncoder