Fix for #1686

Adding an OR in the query was short-circuiting the logic.  We need to
group things with parentheses.
Merge pull request #1688 from pculture/gh-1686

Fix for #1686
Merge remote-tracking branch 'origin/staging' into dev