diff --git a/pyopencl/__init__.py b/pyopencl/__init__.py
index 633b59c4f8a38212585cf7566ed5df1b6dd4efba..522e7e3296a29b8f9e9fc0c49882dc616cb615b9 100644
--- a/pyopencl/__init__.py
+++ b/pyopencl/__init__.py
@@ -66,7 +66,10 @@ def compiler_output(text):
 
 class Kernel(_cl._Kernel):
     def __init__(self, prg, name):
-        _cl._Kernel.__init__(self, prg._get_prg(), name)
+        if not isinstance(prg, _cl._Program):
+            prg = prg._get_prg()
+
+        _cl._Kernel.__init__(self, prg, name)
 
 # }}}