bugfix: checking for existence of variables correctly to silence errors in logs