diff --git a/OpenCL.cabal b/OpenCL.cabal
--- a/OpenCL.cabal
+++ b/OpenCL.cabal
@@ -1,5 +1,5 @@
 Name: OpenCL
-Version: 1.0.2.4
+Version: 1.0.2.6
 License: BSD3
 License-File: LICENSE
 Author: Luis Cabellos
@@ -46,10 +46,14 @@
   Other-Modules: 
     System.GPU.OpenCL.Types
 
+  
+  if os(darwin)
+    cpp-options: "-U__BLOCKS__"
+  
   if os(windows)
-    cpp-options: "-DCALLCONV=stdcall"
+      cpp-options: "-DCALLCONV=stdcall"
   else
-    cpp-options: "-DCALLCONV=ccall"
+      cpp-options: "-DCALLCONV=ccall"
 
   cpp-options: -Iinclude
 
@@ -64,7 +68,7 @@
 source-repository this
   type: git
   location: https://zhensydow@github.com/zhensydow/opencl.git
-  tag: 1.0.2.4
+  tag: 1.0.2.6
   branch: master
 
 source-repository head
diff --git a/include/CL/cl.h b/include/CL/cl.h
--- a/include/CL/cl.h
+++ b/include/CL/cl.h
@@ -588,7 +588,8 @@
                 size_t          /* param_value_size */, 
                 void *          /* param_value */,
                 size_t *        /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
-    
+
+#ifdef CL_API_SUFFIX__VERSION_1_2
 extern CL_API_ENTRY cl_int CL_API_CALL
 clCreateSubDevices(cl_device_id                         /* in_device */,
                    const cl_device_partition_property * /* properties */,
@@ -601,7 +602,8 @@
     
 extern CL_API_ENTRY cl_int CL_API_CALL
 clReleaseDevice(cl_device_id /* device */) CL_API_SUFFIX__VERSION_1_2;
-    
+#endif
+
 /* Context APIs  */
 extern CL_API_ENTRY cl_context CL_API_CALL
 clCreateContext(const cl_context_properties * /* properties */,
@@ -666,6 +668,8 @@
                   const void *             /* buffer_create_info */,
                   cl_int *                 /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1;
 
+#ifdef CL_API_SUFFIX__VERSION_1_2
+
 extern CL_API_ENTRY cl_mem CL_API_CALL
 clCreateImage(cl_context              /* context */,
               cl_mem_flags            /* flags */,
@@ -673,6 +677,7 @@
               const cl_image_desc *   /* image_desc */, 
               void *                  /* host_ptr */,
               cl_int *                /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
+#endif
                         
 extern CL_API_ENTRY cl_int CL_API_CALL
 clRetainMemObject(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0;
@@ -745,12 +750,15 @@
                           cl_int *                       /* binary_status */,
                           cl_int *                       /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
 
+#ifdef CL_API_SUFFIX__VERSION_1_2
+
 extern CL_API_ENTRY cl_program CL_API_CALL
 clCreateProgramWithBuiltInKernels(cl_context            /* context */,
                                   cl_uint               /* num_devices */,
                                   const cl_device_id *  /* device_list */,
                                   const char *          /* kernel_names */,
                                   cl_int *              /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
+#endif
 
 extern CL_API_ENTRY cl_int CL_API_CALL
 clRetainProgram(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0;
@@ -766,6 +774,7 @@
                void (CL_CALLBACK *  /* pfn_notify */)(cl_program /* program */, void * /* user_data */),
                void *               /* user_data */) CL_API_SUFFIX__VERSION_1_0;
 
+#ifdef CL_API_SUFFIX__VERSION_1_2
 extern CL_API_ENTRY cl_int CL_API_CALL
 clCompileProgram(cl_program           /* program */,
                  cl_uint              /* num_devices */,
@@ -788,9 +797,9 @@
               void *               /* user_data */,
               cl_int *             /* errcode_ret */ ) CL_API_SUFFIX__VERSION_1_2;
 
-
 extern CL_API_ENTRY cl_int CL_API_CALL
 clUnloadPlatformCompiler(cl_platform_id /* platform */) CL_API_SUFFIX__VERSION_1_2;
+#endif
 
 extern CL_API_ENTRY cl_int CL_API_CALL
 clGetProgramInfo(cl_program         /* program */,
@@ -838,6 +847,7 @@
                 void *          /* param_value */,
                 size_t *        /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
 
+#ifdef CL_API_SUFFIX__VERSION_1_2
 extern CL_API_ENTRY cl_int CL_API_CALL
 clGetKernelArgInfo(cl_kernel       /* kernel */,
                    cl_uint         /* arg_indx */,
@@ -845,6 +855,7 @@
                    size_t          /* param_value_size */,
                    void *          /* param_value */,
                    size_t *        /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_2;
+#endif
 
 extern CL_API_ENTRY cl_int CL_API_CALL
 clGetKernelWorkGroupInfo(cl_kernel                  /* kernel */,
@@ -955,7 +966,8 @@
                          cl_uint             /* num_events_in_wait_list */,
                          const cl_event *    /* event_wait_list */,
                          cl_event *          /* event */) CL_API_SUFFIX__VERSION_1_1;
-                            
+
+#ifdef CL_API_SUFFIX__VERSION_1_2
 extern CL_API_ENTRY cl_int CL_API_CALL
 clEnqueueFillBuffer(cl_command_queue   /* command_queue */,
                     cl_mem             /* buffer */, 
@@ -966,6 +978,7 @@
                     cl_uint            /* num_events_in_wait_list */, 
                     const cl_event *   /* event_wait_list */, 
                     cl_event *         /* event */) CL_API_SUFFIX__VERSION_1_2;
+#endif
                             
 extern CL_API_ENTRY cl_int CL_API_CALL
 clEnqueueCopyBuffer(cl_command_queue    /* command_queue */, 
@@ -1019,6 +1032,7 @@
                     const cl_event *    /* event_wait_list */,
                     cl_event *          /* event */) CL_API_SUFFIX__VERSION_1_0;
 
+#ifdef CL_API_SUFFIX__VERSION_1_2
 extern CL_API_ENTRY cl_int CL_API_CALL
 clEnqueueFillImage(cl_command_queue   /* command_queue */,
                    cl_mem             /* image */, 
@@ -1028,6 +1042,7 @@
                    cl_uint            /* num_events_in_wait_list */, 
                    const cl_event *   /* event_wait_list */, 
                    cl_event *         /* event */) CL_API_SUFFIX__VERSION_1_2;
+#endif
                             
 extern CL_API_ENTRY cl_int CL_API_CALL
 clEnqueueCopyImage(cl_command_queue     /* command_queue */,
@@ -1096,6 +1111,7 @@
                         const cl_event *  /* event_wait_list */,
                         cl_event *        /* event */) CL_API_SUFFIX__VERSION_1_0;
 
+#ifdef CL_API_SUFFIX__VERSION_1_2
 extern CL_API_ENTRY cl_int CL_API_CALL
 clEnqueueMigrateMemObjects(cl_command_queue       /* command_queue */,
                            cl_uint                /* num_mem_objects */,
@@ -1104,6 +1120,7 @@
                            cl_uint                /* num_events_in_wait_list */,
                            const cl_event *       /* event_wait_list */,
                            cl_event *             /* event */) CL_API_SUFFIX__VERSION_1_2;
+#endif
 
 extern CL_API_ENTRY cl_int CL_API_CALL
 clEnqueueNDRangeKernel(cl_command_queue /* command_queue */,
@@ -1135,6 +1152,7 @@
                       const cl_event *  /* event_wait_list */,
                       cl_event *        /* event */) CL_API_SUFFIX__VERSION_1_0;
 
+#ifdef CL_API_SUFFIX__VERSION_1_2
 extern CL_API_ENTRY cl_int CL_API_CALL
 clEnqueueMarkerWithWaitList(cl_command_queue /* command_queue */,
                             cl_uint           /* num_events_in_wait_list */,
@@ -1154,7 +1172,7 @@
                                                           char * /* printf_data_ptr */, 
                                                           void * /* user_data */),
                     void *              /* user_data */) CL_API_SUFFIX__VERSION_1_2;
-
+#endif
 
 
 /* Extension function access
@@ -1164,10 +1182,11 @@
  * check to make sure the address is not NULL, before using or 
  * calling the returned function address.
  */
+#ifdef CL_API_SUFFIX__VERSION_1_2
 extern CL_API_ENTRY void * CL_API_CALL 
 clGetExtensionFunctionAddressForPlatform(cl_platform_id /* platform */,
                                          const char *   /* func_name */) CL_API_SUFFIX__VERSION_1_2;
-    
+#endif 
     
 #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
 #warning CL_USE_DEPRECATED_OPENCL_1_0_APIS is defined. These APIs are unsupported and untested in OpenCL 1.1!
diff --git a/src/System/GPU/OpenCL/CommandQueue.chs b/src/System/GPU/OpenCL/CommandQueue.chs
--- a/src/System/GPU/OpenCL/CommandQueue.chs
+++ b/src/System/GPU/OpenCL/CommandQueue.chs
@@ -180,8 +180,9 @@
 --
 -- This function execute OpenCL clGetCommandQueueInfo with 'CL_QUEUE_CONTEXT'.
 clGetCommandQueueContext :: CLCommandQueue -> IO CLContext
-clGetCommandQueueContext cq = wrapGetInfo (\(dat :: Ptr CLContext) 
-                                           -> raw_clGetCommandQueueInfo cq infoid size (castPtr dat)) id
+clGetCommandQueueContext cq =
+    wrapGetInfo (\(dat :: Ptr CLContext) ->
+        raw_clGetCommandQueueInfo cq infoid size (castPtr dat)) id
     where 
       infoid = getCLValue CL_QUEUE_CONTEXT
       size = fromIntegral $ sizeOf (nullPtr::CLContext)
@@ -190,8 +191,9 @@
 --
 -- This function execute OpenCL clGetCommandQueueInfo with 'CL_QUEUE_DEVICE'.
 clGetCommandQueueDevice :: CLCommandQueue -> IO CLDeviceID
-clGetCommandQueueDevice cq = wrapGetInfo (\(dat :: Ptr CLDeviceID) 
-                                           -> raw_clGetCommandQueueInfo cq infoid size (castPtr dat)) id
+clGetCommandQueueDevice cq =
+    wrapGetInfo (\(dat :: Ptr CLDeviceID) ->
+        raw_clGetCommandQueueInfo cq infoid size (castPtr dat)) id
     where 
       infoid = getCLValue CL_QUEUE_DEVICE
       size = fromIntegral $ sizeOf (nullPtr::CLDeviceID)
@@ -204,8 +206,9 @@
 -- This function execute OpenCL clGetCommandQueueInfo with
 -- 'CL_QUEUE_REFERENCE_COUNT'.
 clGetCommandQueueReferenceCount :: CLCommandQueue -> IO CLuint
-clGetCommandQueueReferenceCount cq = wrapGetInfo (\(dat :: Ptr CLuint) 
-                                           -> raw_clGetCommandQueueInfo cq infoid size (castPtr dat)) id
+clGetCommandQueueReferenceCount cq =
+    wrapGetInfo (\(dat :: Ptr CLuint) ->
+        raw_clGetCommandQueueInfo cq infoid size (castPtr dat)) id
     where 
       infoid = getCLValue CL_QUEUE_REFERENCE_COUNT
       size = fromIntegral $ sizeOf (0::CLuint)
@@ -218,8 +221,9 @@
 -- This function execute OpenCL clGetCommandQueueInfo with
 -- 'CL_QUEUE_PROPERTIES'.
 clGetCommandQueueProperties :: CLCommandQueue -> IO [CLCommandQueueProperty]
-clGetCommandQueueProperties cq = wrapGetInfo (\(dat :: Ptr CLCommandQueueProperty_) 
-                                           -> raw_clGetCommandQueueInfo cq infoid size (castPtr dat)) bitmaskToCommandQueueProperties
+clGetCommandQueueProperties cq =
+    wrapGetInfo (\(dat :: Ptr CLCommandQueueProperty_) ->
+        raw_clGetCommandQueueInfo cq infoid size (castPtr dat)) bitmaskToCommandQueueProperties
     where 
       infoid = getCLValue CL_QUEUE_PROPERTIES
       size = fromIntegral $ sizeOf (0::CLCommandQueueProperty_)
diff --git a/src/System/GPU/OpenCL/Context.chs b/src/System/GPU/OpenCL/Context.chs
--- a/src/System/GPU/OpenCL/Context.chs
+++ b/src/System/GPU/OpenCL/Context.chs
@@ -139,8 +139,9 @@
 --
 -- This function execute OpenCL clGetContextInfo with 'CL_CONTEXT_REFERENCE_COUNT'.
 clGetContextReferenceCount :: CLContext -> IO CLuint
-clGetContextReferenceCount ctx = wrapGetInfo (\(dat :: Ptr CLuint) 
-                                              -> raw_clGetContextInfo ctx infoid size (castPtr dat)) id
+clGetContextReferenceCount ctx =
+    wrapGetInfo (\(dat :: Ptr CLuint) ->
+        raw_clGetContextInfo ctx infoid size (castPtr dat)) id
     where 
       infoid = getCLValue CL_CONTEXT_REFERENCE_COUNT
       size = fromIntegral $ sizeOf (0::CLuint)
diff --git a/src/System/GPU/OpenCL/Event.chs b/src/System/GPU/OpenCL/Event.chs
--- a/src/System/GPU/OpenCL/Event.chs
+++ b/src/System/GPU/OpenCL/Event.chs
@@ -110,8 +110,9 @@
 --
 -- This function execute OpenCL clGetEventInfo with 'CL_EVENT_COMMAND_QUEUE'.
 clGetEventCommandQueue :: CLEvent -> IO CLCommandQueue
-clGetEventCommandQueue ev = wrapGetInfo (\(dat :: Ptr CLCommandQueue) 
-                                         -> raw_clGetEventInfo ev infoid size (castPtr dat)) id
+clGetEventCommandQueue ev =
+    wrapGetInfo (\(dat :: Ptr CLCommandQueue) ->
+        raw_clGetEventInfo ev infoid size (castPtr dat)) id
     where 
       infoid = getCLValue CL_EVENT_COMMAND_QUEUE
       size = fromIntegral $ sizeOf (nullPtr::CLCommandQueue)
@@ -120,8 +121,9 @@
 --
 -- This function execute OpenCL clGetEventInfo with 'CL_EVENT_COMMAND_TYPE'.
 clGetEventCommandType :: CLEvent -> IO CLCommandType
-clGetEventCommandType ev = wrapGetInfo (\(dat :: Ptr CLCommandType_) 
-                                        -> raw_clGetEventInfo ev infoid size (castPtr dat)) getEnumCL
+clGetEventCommandType ev =
+    wrapGetInfo (\(dat :: Ptr CLCommandType_) ->
+        raw_clGetEventInfo ev infoid size (castPtr dat)) getEnumCL
     where 
       infoid = getCLValue CL_EVENT_COMMAND_TYPE
       size = fromIntegral $ sizeOf (0::CLCommandType_)
@@ -132,8 +134,9 @@
 --
 -- This function execute OpenCL clGetEventInfo with 'CL_EVENT_REFERENCE_COUNT'.
 clGetEventReferenceCount :: CLEvent -> IO CLint
-clGetEventReferenceCount ev = wrapGetInfo (\(dat :: Ptr CLint) 
-                                           -> raw_clGetEventInfo ev infoid size (castPtr dat)) id
+clGetEventReferenceCount ev =
+    wrapGetInfo (\(dat :: Ptr CLint) ->
+        raw_clGetEventInfo ev infoid size (castPtr dat)) id
     where 
       infoid = getCLValue CL_EVENT_REFERENCE_COUNT
       size = fromIntegral $ sizeOf (0::CLint)
@@ -143,8 +146,9 @@
 -- This function execute OpenCL clGetEventInfo with
 -- 'CL_EVENT_COMMAND_EXECUTION_STATUS'.
 clGetEventCommandExecutionStatus :: CLEvent -> IO CLCommandExecutionStatus
-clGetEventCommandExecutionStatus ev = wrapGetInfo (\(dat :: Ptr CLint) 
-                                                   -> raw_clGetEventInfo ev infoid size (castPtr dat)) getCommandExecutionStatus
+clGetEventCommandExecutionStatus ev =
+    wrapGetInfo (\(dat :: Ptr CLint) ->
+        raw_clGetEventInfo ev infoid size (castPtr dat)) getCommandExecutionStatus
     where 
       infoid = getCLValue CL_EVENT_COMMAND_EXECUTION_STATUS
       size = fromIntegral $ sizeOf (0::CLint)
@@ -173,8 +177,9 @@
 not a valid event object.
 -} 
 clGetEventProfilingInfo :: CLEvent -> CLProfilingInfo -> IO CLulong
-clGetEventProfilingInfo ev prof = wrapGetInfo (\(dat :: Ptr CLulong) 
-                                               -> raw_clGetEventProfilingInfo ev infoid size (castPtr dat)) id
+clGetEventProfilingInfo ev prof =
+    wrapGetInfo (\(dat :: Ptr CLulong) ->
+        raw_clGetEventProfilingInfo ev infoid size (castPtr dat)) id
     where 
       infoid = getCLValue prof
       size = fromIntegral $ sizeOf (0::CLulong)
diff --git a/src/System/GPU/OpenCL/Memory.chs b/src/System/GPU/OpenCL/Memory.chs
--- a/src/System/GPU/OpenCL/Memory.chs
+++ b/src/System/GPU/OpenCL/Memory.chs
@@ -146,8 +146,9 @@
 --
 -- This function execute OpenCL clGetMemObjectInfo with 'CL_MEM_TYPE'.
 clGetMemType :: CLMem -> IO CLMemObjectType
-clGetMemType mem = wrapGetInfo (\(dat :: Ptr CLMemObjectType_) 
-                                -> raw_clGetMemObjectInfo mem infoid size (castPtr dat)) getEnumCL
+clGetMemType mem =
+    wrapGetInfo (\(dat :: Ptr CLMemObjectType_) ->
+        raw_clGetMemObjectInfo mem infoid size (castPtr dat)) getEnumCL
     where 
       infoid = getCLValue CL_MEM_TYPE
       size = fromIntegral $ sizeOf (0::CLMemObjectType_)
@@ -156,8 +157,9 @@
 --
 -- This function execute OpenCL clGetMemObjectInfo with 'CL_MEM_FLAGS'.
 clGetMemFlags :: CLMem -> IO [CLMemFlag]
-clGetMemFlags mem = wrapGetInfo (\(dat :: Ptr CLMemFlags_)
-                                  -> raw_clGetMemObjectInfo mem infoid size (castPtr dat)) bitmaskToMemFlags
+clGetMemFlags mem =
+    wrapGetInfo (\(dat :: Ptr CLMemFlags_)->
+        raw_clGetMemObjectInfo mem infoid size (castPtr dat)) bitmaskToMemFlags
     where 
       infoid = getCLValue CL_MEM_FLAGS
       size = fromIntegral $ sizeOf (0::CLMemFlags_)
@@ -166,8 +168,9 @@
 --
 -- This function execute OpenCL clGetMemObjectInfo with 'CL_MEM_SIZE'.
 clGetMemSize :: CLMem -> IO CSize
-clGetMemSize mem = wrapGetInfo (\(dat :: Ptr CSize)
-                                 -> raw_clGetMemObjectInfo mem infoid size (castPtr dat)) id
+clGetMemSize mem =
+    wrapGetInfo (\(dat :: Ptr CSize)->
+        raw_clGetMemObjectInfo mem infoid size (castPtr dat)) id
     where 
       infoid = getCLValue CL_MEM_SIZE
       size = fromIntegral $ sizeOf (0::CSize)
@@ -176,8 +179,9 @@
 --
 -- This function execute OpenCL clGetMemObjectInfo with 'CL_MEM_HOST_PTR'.
 clGetMemHostPtr :: CLMem -> IO (Ptr ())
-clGetMemHostPtr mem = wrapGetInfo (\(dat :: Ptr (Ptr ()))
-                                   -> raw_clGetMemObjectInfo mem infoid size (castPtr dat)) id
+clGetMemHostPtr mem =
+    wrapGetInfo (\(dat :: Ptr (Ptr ()))->
+        raw_clGetMemObjectInfo mem infoid size (castPtr dat)) id
     where 
       infoid = getCLValue CL_MEM_HOST_PTR
       size = fromIntegral $ sizeOf (nullPtr::Ptr ())
@@ -188,8 +192,9 @@
 --
 -- This function execute OpenCL clGetMemObjectInfo with 'CL_MEM_MAP_COUNT'.
 clGetMemMapCount :: CLMem -> IO CLuint
-clGetMemMapCount mem = wrapGetInfo (\(dat :: Ptr CLuint)
-                                   -> raw_clGetMemObjectInfo mem infoid size (castPtr dat)) id
+clGetMemMapCount mem =
+    wrapGetInfo (\(dat :: Ptr CLuint)->
+        raw_clGetMemObjectInfo mem infoid size (castPtr dat)) id
     where 
       infoid = getCLValue CL_MEM_MAP_COUNT
       size = fromIntegral $ sizeOf (0 :: CLuint)
@@ -200,8 +205,9 @@
 --
 -- This function execute OpenCL clGetMemObjectInfo with 'CL_MEM_REFERENCE_COUNT'.
 clGetMemReferenceCount :: CLMem -> IO CLuint
-clGetMemReferenceCount mem = wrapGetInfo (\(dat :: Ptr CLuint)
-                                   -> raw_clGetMemObjectInfo mem infoid size (castPtr dat)) id
+clGetMemReferenceCount mem =
+    wrapGetInfo (\(dat :: Ptr CLuint)->
+        raw_clGetMemObjectInfo mem infoid size (castPtr dat)) id
     where 
       infoid = getCLValue CL_MEM_REFERENCE_COUNT
       size = fromIntegral $ sizeOf (0 :: CLuint)
@@ -210,8 +216,9 @@
 --
 -- This function execute OpenCL clGetMemObjectInfo with 'CL_MEM_CONTEXT'.
 clGetMemContext :: CLMem -> IO CLContext
-clGetMemContext mem = wrapGetInfo (\(dat :: Ptr CLContext)
-                                   -> raw_clGetMemObjectInfo mem infoid size (castPtr dat)) id
+clGetMemContext mem =
+    wrapGetInfo (\(dat :: Ptr CLContext)->
+        raw_clGetMemObjectInfo mem infoid size (castPtr dat)) id
     where 
       infoid = getCLValue CL_MEM_CONTEXT
       size = fromIntegral $ sizeOf (0 :: CLuint)
@@ -277,8 +284,9 @@
 -- This function execute OpenCL clGetSamplerInfo with
 -- 'CL_SAMPLER_REFERENCE_COUNT'.
 clGetSamplerReferenceCount :: CLSampler -> IO CLuint
-clGetSamplerReferenceCount sam = wrapGetInfo (\(dat :: Ptr CLuint)
-                                   -> raw_clGetSamplerInfo sam infoid size (castPtr dat)) id
+clGetSamplerReferenceCount sam =
+    wrapGetInfo (\(dat :: Ptr CLuint)->
+        raw_clGetSamplerInfo sam infoid size (castPtr dat)) id
     where 
       infoid = getCLValue CL_SAMPLER_REFERENCE_COUNT
       size = fromIntegral $ sizeOf (0 :: CLuint)
@@ -287,8 +295,9 @@
 --
 -- This function execute OpenCL clGetSamplerInfo with 'CL_SAMPLER_CONTEXT'.
 clGetSamplerContext :: CLSampler -> IO CLContext
-clGetSamplerContext sam = wrapGetInfo (\(dat :: Ptr CLContext)
-                                       -> raw_clGetSamplerInfo sam infoid size (castPtr dat)) id
+clGetSamplerContext sam =
+    wrapGetInfo (\(dat :: Ptr CLContext)->
+        raw_clGetSamplerInfo sam infoid size (castPtr dat)) id
     where 
       infoid = getCLValue CL_SAMPLER_CONTEXT
       size = fromIntegral $ sizeOf (nullPtr :: CLContext)
@@ -298,8 +307,9 @@
 -- This function execute OpenCL clGetSamplerInfo with
 -- 'CL_SAMPLER_ADDRESSING_MODE'.
 clGetSamplerAddressingMode :: CLSampler -> IO CLAddressingMode
-clGetSamplerAddressingMode sam = wrapGetInfo (\(dat :: Ptr CLAddressingMode_)
-                                              -> raw_clGetSamplerInfo sam infoid size (castPtr dat)) getEnumCL
+clGetSamplerAddressingMode sam =
+    wrapGetInfo (\(dat :: Ptr CLAddressingMode_)->
+        raw_clGetSamplerInfo sam infoid size (castPtr dat)) getEnumCL
     where 
       infoid = getCLValue CL_SAMPLER_ADDRESSING_MODE
       size = fromIntegral $ sizeOf (0 :: CLAddressingMode_)
@@ -308,8 +318,9 @@
 --
 -- This function execute OpenCL clGetSamplerInfo with 'CL_SAMPLER_FILTER_MODE'.
 clGetSamplerFilterMode :: CLSampler -> IO CLFilterMode
-clGetSamplerFilterMode sam = wrapGetInfo (\(dat :: Ptr CLFilterMode_)
-                                          -> raw_clGetSamplerInfo sam infoid size (castPtr dat)) getEnumCL
+clGetSamplerFilterMode sam =
+    wrapGetInfo (\(dat :: Ptr CLFilterMode_)->
+        raw_clGetSamplerInfo sam infoid size (castPtr dat)) getEnumCL
     where 
       infoid = getCLValue CL_SAMPLER_FILTER_MODE
       size = fromIntegral $ sizeOf (0 :: CLFilterMode_)
@@ -320,8 +331,9 @@
 -- This function execute OpenCL clGetSamplerInfo with
 -- 'CL_SAMPLER_NORMALIZED_COORDS'.
 clGetSamplerNormalizedCoords :: CLSampler -> IO Bool
-clGetSamplerNormalizedCoords sam = wrapGetInfo (\(dat :: Ptr CLbool)
-                                                -> raw_clGetSamplerInfo sam infoid size (castPtr dat)) (/=0)
+clGetSamplerNormalizedCoords sam =
+    wrapGetInfo (\(dat :: Ptr CLbool)->
+        raw_clGetSamplerInfo sam infoid size (castPtr dat)) (/=0)
     where 
       infoid = getCLValue CL_SAMPLER_NORMALIZED_COORDS
       size = fromIntegral $ sizeOf (0 :: CLbool)
diff --git a/src/System/GPU/OpenCL/Program.chs b/src/System/GPU/OpenCL/Program.chs
--- a/src/System/GPU/OpenCL/Program.chs
+++ b/src/System/GPU/OpenCL/Program.chs
@@ -52,7 +52,7 @@
 import Control.Monad( zipWithM, forM )
 import Foreign
 import Foreign.C.Types
-import Foreign.C.String( CString, withCString, newCString, peekCString )
+import Foreign.C.String( CString, withCString, peekCString )
 import System.GPU.OpenCL.Types( 
   CLint, CLuint, CLulong, CLProgram, CLContext, CLKernel, CLDeviceID, CLError,
   CLProgramInfo_, CLBuildStatus(..), CLBuildStatus_, CLProgramBuildInfo_, 
@@ -127,15 +127,11 @@
 by the OpenCL implementation on the host.  
 -}
 clCreateProgramWithSource :: CLContext -> String -> IO CLProgram
-clCreateProgramWithSource ctx source = wrapPError $ \perr -> do
-  let strings = lines source
-      count = fromIntegral $ length strings
-  cstrings <- mapM newCString strings
-  prog <- withArray cstrings $ \srcArray -> do
-    raw_clCreateProgramWithSource ctx count srcArray nullPtr perr
-  mapM_ free cstrings
-  return prog
-  
+clCreateProgramWithSource ctx source =
+  withCString source $ \cSource ->
+  withArray [cSource] $ \sourcesP ->
+  wrapPError (raw_clCreateProgramWithSource ctx 1 sourcesP nullPtr)
+
 {-| Creates a program object for a context, and loads specified binary data into
 the program object.
 
@@ -405,8 +401,9 @@
 -- This function execute OpenCL clGetProgramInfo with
 -- 'CL_PROGRAM_REFERENCE_COUNT'.
 clGetProgramReferenceCount :: CLProgram -> IO CLuint
-clGetProgramReferenceCount prg = wrapGetInfo (\(dat :: Ptr CLuint) 
-                                              -> raw_clGetProgramInfo prg infoid size (castPtr dat)) id
+clGetProgramReferenceCount prg =
+    wrapGetInfo (\(dat :: Ptr CLuint) ->
+        raw_clGetProgramInfo prg infoid size (castPtr dat)) id
     where 
       infoid = getCLValue CL_PROGRAM_REFERENCE_COUNT
       size = fromIntegral $ sizeOf (0::CLuint)
@@ -415,8 +412,9 @@
 --
 -- This function execute OpenCL clGetProgramInfo with 'CL_PROGRAM_CONTEXT'.
 clGetProgramContext :: CLProgram -> IO CLContext
-clGetProgramContext prg = wrapGetInfo (\(dat :: Ptr CLContext) 
-                                       -> raw_clGetProgramInfo prg infoid size (castPtr dat)) id
+clGetProgramContext prg =
+    wrapGetInfo (\(dat :: Ptr CLContext) ->
+        raw_clGetProgramInfo prg infoid size (castPtr dat)) id
     where 
       infoid = getCLValue CL_PROGRAM_CONTEXT
       size = fromIntegral $ sizeOf (nullPtr::CLContext)
@@ -425,8 +423,9 @@
 --
 -- This function execute OpenCL clGetProgramInfo with 'CL_PROGRAM_NUM_DEVICES'.
 clGetProgramNumDevices :: CLProgram -> IO CLuint
-clGetProgramNumDevices prg = wrapGetInfo (\(dat :: Ptr CLuint) 
-                                       -> raw_clGetProgramInfo prg infoid size (castPtr dat)) id
+clGetProgramNumDevices prg =
+    wrapGetInfo (\(dat :: Ptr CLuint) ->
+        raw_clGetProgramInfo prg infoid size (castPtr dat)) id
     where 
       infoid = getCLValue CL_PROGRAM_NUM_DEVICES
       size = fromIntegral $ sizeOf (0::CLuint)
@@ -535,8 +534,9 @@
 -- This function execute OpenCL clGetProgramBuildInfo with
 -- 'CL_PROGRAM_BUILD_STATUS'.
 clGetProgramBuildStatus :: CLProgram -> CLDeviceID -> IO CLBuildStatus
-clGetProgramBuildStatus prg device = wrapGetInfo (\(dat :: Ptr CLBuildStatus_) 
-                                           -> raw_clGetProgramBuildInfo prg device infoid size (castPtr dat)) getEnumCL
+clGetProgramBuildStatus prg device =
+    wrapGetInfo (\(dat :: Ptr CLBuildStatus_) ->
+        raw_clGetProgramBuildInfo prg device infoid size (castPtr dat)) getEnumCL
     where 
       infoid = getCLValue CL_PROGRAM_BUILD_STATUS
       size = fromIntegral $ sizeOf (0::CLBuildStatus_)
@@ -719,8 +719,9 @@
 --
 -- This function execute OpenCL clGetKernelInfo with 'CL_KERNEL_NUM_ARGS'.
 clGetKernelNumArgs :: CLKernel -> IO CLuint
-clGetKernelNumArgs krn = wrapGetInfo (\(dat :: Ptr CLuint) 
-                                      -> raw_clGetKernelInfo krn infoid size (castPtr dat)) id
+clGetKernelNumArgs krn =
+    wrapGetInfo (\(dat :: Ptr CLuint) ->
+        raw_clGetKernelInfo krn infoid size (castPtr dat)) id
     where 
       infoid = getCLValue CL_KERNEL_NUM_ARGS
       size = fromIntegral $ sizeOf (0::CLuint)
@@ -732,8 +733,9 @@
 -- This function execute OpenCL clGetKernelInfo with
 -- 'CL_KERNEL_REFERENCE_COUNT'.
 clGetKernelReferenceCount :: CLKernel -> IO CLuint
-clGetKernelReferenceCount krn = wrapGetInfo (\(dat :: Ptr CLuint) 
-                                             -> raw_clGetKernelInfo krn infoid size (castPtr dat)) id
+clGetKernelReferenceCount krn =
+    wrapGetInfo (\(dat :: Ptr CLuint) ->
+        raw_clGetKernelInfo krn infoid size (castPtr dat)) id
     where 
       infoid = getCLValue CL_KERNEL_REFERENCE_COUNT
       size = fromIntegral $ sizeOf (0::CLuint)
@@ -742,8 +744,9 @@
 --
 -- This function execute OpenCL clGetKernelInfo with 'CL_KERNEL_CONTEXT'.
 clGetKernelContext :: CLKernel -> IO CLContext
-clGetKernelContext krn = wrapGetInfo (\(dat :: Ptr CLContext) 
-                                      -> raw_clGetKernelInfo krn infoid size (castPtr dat)) id
+clGetKernelContext krn =
+    wrapGetInfo (\(dat :: Ptr CLContext) ->
+        raw_clGetKernelInfo krn infoid size (castPtr dat)) id
     where 
       infoid = getCLValue CL_KERNEL_CONTEXT
       size = fromIntegral $ sizeOf (nullPtr::CLContext)
@@ -752,8 +755,9 @@
 --
 -- This function execute OpenCL clGetKernelInfo with 'CL_KERNEL_PROGRAM'.
 clGetKernelProgram :: CLKernel -> IO CLProgram
-clGetKernelProgram krn = wrapGetInfo (\(dat :: Ptr CLProgram) 
-                                      -> raw_clGetKernelInfo krn infoid size (castPtr dat)) id
+clGetKernelProgram krn =
+    wrapGetInfo (\(dat :: Ptr CLProgram) ->
+        raw_clGetKernelInfo krn infoid size (castPtr dat)) id
     where 
       infoid = getCLValue CL_KERNEL_PROGRAM
       size = fromIntegral $ sizeOf (nullPtr::CLProgram)
@@ -777,8 +781,9 @@
 -- This function execute OpenCL clGetKernelWorkGroupInfo with
 -- 'CL_KERNEL_WORK_GROUP_SIZE'.
 clGetKernelWorkGroupSize :: CLKernel -> CLDeviceID -> IO CSize
-clGetKernelWorkGroupSize krn device = wrapGetInfo (\(dat :: Ptr CSize)
-                                                   -> raw_clGetKernelWorkGroupInfo krn device infoid size (castPtr dat)) id
+clGetKernelWorkGroupSize krn device =
+    wrapGetInfo (\(dat :: Ptr CSize) ->
+        raw_clGetKernelWorkGroupInfo krn device infoid size (castPtr dat)) id
     where
       infoid = getCLValue CL_KERNEL_WORK_GROUP_SIZE
       size = fromIntegral $ sizeOf (0::CSize)
@@ -816,8 +821,9 @@
 -- This function execute OpenCL clGetKernelWorkGroupInfo with
 -- 'CL_KERNEL_LOCAL_MEM_SIZE'.
 clGetKernelLocalMemSize :: CLKernel -> CLDeviceID -> IO CLulong
-clGetKernelLocalMemSize krn device = wrapGetInfo (\(dat :: Ptr CLulong)
-                                                  -> raw_clGetKernelWorkGroupInfo krn device infoid size (castPtr dat)) id
+clGetKernelLocalMemSize krn device =
+    wrapGetInfo (\(dat :: Ptr CLulong) ->
+        raw_clGetKernelWorkGroupInfo krn device infoid size (castPtr dat)) id
     where
       infoid = getCLValue CL_KERNEL_LOCAL_MEM_SIZE
       size = fromIntegral $ sizeOf (0::CLulong)
diff --git a/src/System/GPU/OpenCL/Types.chs b/src/System/GPU/OpenCL/Types.chs
--- a/src/System/GPU/OpenCL/Types.chs
+++ b/src/System/GPU/OpenCL/Types.chs
@@ -699,7 +699,14 @@
 bitmaskToFlags xs mask = filter (testMask mask . fromIntegral . fromEnum) xs
 
 bitmaskToDeviceTypes :: CLDeviceType_ -> [CLDeviceType]
-bitmaskToDeviceTypes = bitmaskToFlags [CL_DEVICE_TYPE_CPU,CL_DEVICE_TYPE_GPU,CL_DEVICE_TYPE_ACCELERATOR,CL_DEVICE_TYPE_DEFAULT,CL_DEVICE_TYPE_ALL]
+bitmaskToDeviceTypes =
+	bitmaskToFlags 
+		[CL_DEVICE_TYPE_CPU
+		,CL_DEVICE_TYPE_GPU
+		,CL_DEVICE_TYPE_ACCELERATOR
+		,CL_DEVICE_TYPE_DEFAULT
+		,CL_DEVICE_TYPE_ALL
+		]
 
 bitmaskToCommandQueueProperties :: CLCommandQueueProperty_ -> [CLCommandQueueProperty]
 bitmaskToCommandQueueProperties = bitmaskToFlags (binaryFlags maxBound)
