Check/cache value before using it in  to avoid index not set errors (that are logged to system.log file).