Added some event handling in the network manager.