diff --git a/mhcflurry/common.py b/mhcflurry/common.py
index 4d4afe012ecdd88d8379df62f4b1a375b7bee89a..a2da79dcbfe91959760caef538613691b27b5822 100644
--- a/mhcflurry/common.py
+++ b/mhcflurry/common.py
@@ -34,7 +34,7 @@ def set_keras_backend(backend=None, gpu_device_nums=None):
         os.environ["CUDA_VISIBLE_DEVICES"] = ",".join(
             [str(i) for i in gpu_device_nums])
 
-    if backend == "tensorflow-cpu" or not gpu_device_nums:
+    if backend == "tensorflow-cpu" or gpu_device_nums == []:
         print("Forcing tensorflow/CPU backend.")
         os.environ["CUDA_VISIBLE_DEVICES"] = ""
         device_count = {'CPU': 1, 'GPU': 0}