fix crash for NULL agent sockets