check var exists before using