         , (JIT_INFO_LOG_BUFFER_SIZE_BYTES,  logSize)
         , (JIT_ERROR_LOG_BUFFER_SIZE_BYTES, logSize)
         , (JIT_INFO_LOG_BUFFER,  unsafeCoerce (p_ilog :: CString))
-        , (JIT_ERROR_LOG_BUFFER, unsafeCoerce (p_elog :: CString)) ] ++ map unpack options
+        , (JIT_ERROR_LOG_BUFFER, unsafeCoerce (p_elog :: CString)) ] ++ mapMaybe unpack options
 
   withArray (map cFromEnum opt)    $ \p_opts -> do
   withArray (map unsafeCoerce val) $ \p_vals -> do

  where
    logSize = 2048

    unpack (MaxRegisters x)      = (JIT_MAX_REGISTERS,       x)
    unpack (ThreadsPerBlock x)   = (JIT_THREADS_PER_BLOCK,   x)
    unpack (OptimisationLevel x) = (JIT_OPTIMIZATION_LEVEL,  x)
    unpack (Target x)            = (JIT_TARGET,              jitTargetOfCompute x)
    unpack (FallbackStrategy x)  = (JIT_FALLBACK_STRATEGY,   fromEnum x)
#if CUDA_VERSION >= 5050
    unpack GenerateDebugInfo     = (JIT_GENERATE_DEBUG_INFO, fromEnum True)
    unpack GenerateLineInfo      = (JIT_GENERATE_LINE_INFO,  fromEnum True)
    unpack Verbose               = (JIT_LOG_VERBOSE,         fromEnum True)
#endif

    jitTargetOfCompute (Compute x y)


import Control.Monad                            (liftM)
import Control.Exception                        (throwIO)
import Debug.Trace                              (trace)
import Data.Maybe                               (mapMaybe)
import Data.ByteString.Char8                    (ByteString)
import qualified Data.ByteString.Char8          as B
import qualified Data.ByteString.Internal       as B
