Check if variable exists before using it