Did you know that isDefined returns true for any CGI variable, even if it doesn't exist? For example, this will always output:
What does cgi.ray evaluate to? An empty string. If you really want to check for the existence of CGI variable, either add a len(trim(...)) check, or use structKeyExists(cgi,"somekey").