add nil checks to address bug discovered by Mike
http://seclists.org/nmap-dev/2014/q2/120