fixed potential problem about using unset variables. CS fix.