diff --git a/oargen.py b/oargen.py
index a74bc379c7a689ad10c743a4ec55980dfe329339..b808789c38b3a9c3a4519985b2c448d51dfac61d 100755
--- a/oargen.py
+++ b/oargen.py
@@ -50,9 +50,9 @@ def main():
     command = ["oarsub"]
     properties = "-p \""
     if args.gpu:
-        properties += "gpu IS NOT NULL"
+        properties += "(gpu IS NOT NULL)"
     else:
-        properties += "gpu IS NULL"
+        properties += "(gpu IS NULL)"
     if args.host is not None:
         properties += " AND host LIKE '{}'".format(args.host)
     properties += "\""