Wrap string conditions in parentheses in order to preserve boolean logic

Fixes #372