bugfix: segfault on startup when certain script constructs are used

e.g. "if not $msg ..."
testbench: add new test