do better checking of existence of variables