tests and fix for null agentOptions case