Better error on invalid logic strings.

Thanks to David Cok for reporting this issue.
Fix destruction issue in GetValueCommand leading to crash.

Thanks to David Cok for reporting this.