check if variable exists before using it