diff --git a/GI/GLib.hs b/GI/GLib.hs
--- a/GI/GLib.hs
+++ b/GI/GLib.hs
@@ -536,6 +536,7 @@
     onException (do
         result <- propagateGError $ g_bookmark_file_get_applications _obj' uri' length_
         length_' <- peek length_
+        checkUnexpectedReturnNULL "g_bookmark_file_get_applications" result
         result' <- (unpackUTF8CArrayWithLength length_') result
         (mapCArrayWithLength length_') freeMem result
         freeMem result
@@ -574,6 +575,7 @@
     uri' <- textToCString uri
     onException (do
         result <- propagateGError $ g_bookmark_file_get_description _obj' uri'
+        checkUnexpectedReturnNULL "g_bookmark_file_get_description" result
         result' <- cstringToText result
         freeMem result
         touchManagedPtr _obj
@@ -612,6 +614,7 @@
     onException (do
         result <- propagateGError $ g_bookmark_file_get_groups _obj' uri' length_
         length_' <- peek length_
+        checkUnexpectedReturnNULL "g_bookmark_file_get_groups" result
         result' <- (unpackUTF8CArrayWithLength length_') result
         (mapCArrayWithLength length_') freeMem result
         freeMem result
@@ -730,6 +733,7 @@
     uri' <- textToCString uri
     onException (do
         result <- propagateGError $ g_bookmark_file_get_mime_type _obj' uri'
+        checkUnexpectedReturnNULL "g_bookmark_file_get_mime_type" result
         result' <- cstringToText result
         freeMem result
         touchManagedPtr _obj
@@ -826,6 +830,7 @@
             return jUri'
     onException (do
         result <- propagateGError $ g_bookmark_file_get_title _obj' maybeUri
+        checkUnexpectedReturnNULL "g_bookmark_file_get_title" result
         result' <- cstringToText result
         freeMem result
         touchManagedPtr _obj
@@ -859,6 +864,7 @@
     length_ <- allocMem :: IO (Ptr Word64)
     result <- g_bookmark_file_get_uris _obj' length_
     length_' <- peek length_
+    checkUnexpectedReturnNULL "g_bookmark_file_get_uris" result
     result' <- (unpackUTF8CArrayWithLength length_') result
     (mapCArrayWithLength length_') freeMem result
     freeMem result
@@ -1640,6 +1646,7 @@
     length_ <- allocMem :: IO (Ptr Word64)
     onException (do
         result <- propagateGError $ g_bookmark_file_to_data _obj' length_
+        checkUnexpectedReturnNULL "g_bookmark_file_to_data" result
         result' <- cstringToText result
         freeMem result
         length_' <- peek length_
@@ -1794,6 +1801,7 @@
             jData_' <- packByteString jData_
             return jData_'
     result <- g_bytes_new maybeData_ size
+    checkUnexpectedReturnNULL "g_bytes_new" result
     result' <- (wrapBoxed Bytes) result
     freeMem maybeData_
     return result'
@@ -1827,6 +1835,7 @@
             jData_' <- packByteString jData_
             return jData_'
     result <- g_bytes_new_take maybeData_ size
+    checkUnexpectedReturnNULL "g_bytes_new_take" result
     result' <- (wrapBoxed Bytes) result
     return result'
 
@@ -1911,6 +1920,7 @@
     size <- allocMem :: IO (Ptr Word64)
     result <- g_bytes_get_data _obj' size
     size' <- peek size
+    checkUnexpectedReturnNULL "g_bytes_get_data" result
     result' <- (unpackByteStringWithLength size') result
     touchManagedPtr _obj
     freeMem size
@@ -1989,6 +1999,7 @@
 bytesNewFromBytes _obj offset length_ = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_bytes_new_from_bytes _obj' offset length_
+    checkUnexpectedReturnNULL "g_bytes_new_from_bytes" result
     result' <- (wrapBoxed Bytes) result
     touchManagedPtr _obj
     return result'
@@ -2014,6 +2025,7 @@
 bytesRef _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_bytes_ref _obj'
+    checkUnexpectedReturnNULL "g_bytes_ref" result
     result' <- (wrapBoxed Bytes) result
     touchManagedPtr _obj
     return result'
@@ -2063,6 +2075,7 @@
 bytesUnrefToArray _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_bytes_unref_to_array _obj'
+    checkUnexpectedReturnNULL "g_bytes_unref_to_array" result
     result' <- unpackGByteArray result
     unrefGByteArray result
     touchManagedPtr _obj
@@ -2126,6 +2139,7 @@
 checksumNew checksum_type = liftIO $ do
     let checksum_type' = (fromIntegral . fromEnum) checksum_type
     result <- g_checksum_new checksum_type'
+    checkUnexpectedReturnNULL "g_checksum_new" result
     result' <- (wrapBoxed Checksum) result
     return result'
 
@@ -2150,6 +2164,7 @@
 checksumCopy _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_checksum_copy _obj'
+    checkUnexpectedReturnNULL "g_checksum_copy" result
     result' <- (wrapBoxed Checksum) result
     touchManagedPtr _obj
     return result'
@@ -2199,6 +2214,7 @@
 checksumGetString _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_checksum_get_string _obj'
+    checkUnexpectedReturnNULL "g_checksum_get_string" result
     result' <- cstringToText result
     touchManagedPtr _obj
     return result'
@@ -2683,6 +2699,7 @@
     m Date
 dateNew  = liftIO $ do
     result <- g_date_new
+    checkUnexpectedReturnNULL "g_date_new" result
     result' <- (wrapBoxed Date) result
     return result'
 
@@ -2711,6 +2728,7 @@
 dateNewDmy day month year = liftIO $ do
     let month' = (fromIntegral . fromEnum) month
     result <- g_date_new_dmy day month' year
+    checkUnexpectedReturnNULL "g_date_new_dmy" result
     result' <- (wrapBoxed Date) result
     return result'
 
@@ -2734,6 +2752,7 @@
     m Date
 dateNewJulian julian_day = liftIO $ do
     result <- g_date_new_julian julian_day
+    checkUnexpectedReturnNULL "g_date_new_julian" result
     result' <- (wrapBoxed Date) result
     return result'
 
@@ -3737,6 +3756,7 @@
     let tz' = unsafeManagedPtrGetPtr tz
     let seconds' = realToFrac seconds
     result <- g_date_time_new tz' year month day hour minute seconds'
+    checkUnexpectedReturnNULL "g_date_time_new" result
     result' <- (wrapBoxed DateTime) result
     touchManagedPtr tz
     return result'
@@ -3762,6 +3782,7 @@
 dateTimeNewFromTimevalLocal tv = liftIO $ do
     let tv' = unsafeManagedPtrGetPtr tv
     result <- g_date_time_new_from_timeval_local tv'
+    checkUnexpectedReturnNULL "g_date_time_new_from_timeval_local" result
     result' <- (wrapBoxed DateTime) result
     touchManagedPtr tv
     return result'
@@ -3787,6 +3808,7 @@
 dateTimeNewFromTimevalUtc tv = liftIO $ do
     let tv' = unsafeManagedPtrGetPtr tv
     result <- g_date_time_new_from_timeval_utc tv'
+    checkUnexpectedReturnNULL "g_date_time_new_from_timeval_utc" result
     result' <- (wrapBoxed DateTime) result
     touchManagedPtr tv
     return result'
@@ -3811,6 +3833,7 @@
     m DateTime
 dateTimeNewFromUnixLocal t = liftIO $ do
     result <- g_date_time_new_from_unix_local t
+    checkUnexpectedReturnNULL "g_date_time_new_from_unix_local" result
     result' <- (wrapBoxed DateTime) result
     return result'
 
@@ -3834,6 +3857,7 @@
     m DateTime
 dateTimeNewFromUnixUtc t = liftIO $ do
     result <- g_date_time_new_from_unix_utc t
+    checkUnexpectedReturnNULL "g_date_time_new_from_unix_utc" result
     result' <- (wrapBoxed DateTime) result
     return result'
 
@@ -3868,6 +3892,7 @@
 dateTimeNewLocal year month day hour minute seconds = liftIO $ do
     let seconds' = realToFrac seconds
     result <- g_date_time_new_local year month day hour minute seconds'
+    checkUnexpectedReturnNULL "g_date_time_new_local" result
     result' <- (wrapBoxed DateTime) result
     return result'
 
@@ -3892,6 +3917,7 @@
 dateTimeNewNow tz = liftIO $ do
     let tz' = unsafeManagedPtrGetPtr tz
     result <- g_date_time_new_now tz'
+    checkUnexpectedReturnNULL "g_date_time_new_now" result
     result' <- (wrapBoxed DateTime) result
     touchManagedPtr tz
     return result'
@@ -3914,6 +3940,7 @@
     m DateTime
 dateTimeNewNowLocal  = liftIO $ do
     result <- g_date_time_new_now_local
+    checkUnexpectedReturnNULL "g_date_time_new_now_local" result
     result' <- (wrapBoxed DateTime) result
     return result'
 
@@ -3935,6 +3962,7 @@
     m DateTime
 dateTimeNewNowUtc  = liftIO $ do
     result <- g_date_time_new_now_utc
+    checkUnexpectedReturnNULL "g_date_time_new_now_utc" result
     result' <- (wrapBoxed DateTime) result
     return result'
 
@@ -3969,6 +3997,7 @@
 dateTimeNewUtc year month day hour minute seconds = liftIO $ do
     let seconds' = realToFrac seconds
     result <- g_date_time_new_utc year month day hour minute seconds'
+    checkUnexpectedReturnNULL "g_date_time_new_utc" result
     result' <- (wrapBoxed DateTime) result
     return result'
 
@@ -3995,6 +4024,7 @@
 dateTimeAdd _obj timespan = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_date_time_add _obj' timespan
+    checkUnexpectedReturnNULL "g_date_time_add" result
     result' <- (wrapBoxed DateTime) result
     touchManagedPtr _obj
     return result'
@@ -4022,6 +4052,7 @@
 dateTimeAddDays _obj days = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_date_time_add_days _obj' days
+    checkUnexpectedReturnNULL "g_date_time_add_days" result
     result' <- (wrapBoxed DateTime) result
     touchManagedPtr _obj
     return result'
@@ -4060,6 +4091,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     let seconds' = realToFrac seconds
     result <- g_date_time_add_full _obj' years months days hours minutes seconds'
+    checkUnexpectedReturnNULL "g_date_time_add_full" result
     result' <- (wrapBoxed DateTime) result
     touchManagedPtr _obj
     return result'
@@ -4087,6 +4119,7 @@
 dateTimeAddHours _obj hours = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_date_time_add_hours _obj' hours
+    checkUnexpectedReturnNULL "g_date_time_add_hours" result
     result' <- (wrapBoxed DateTime) result
     touchManagedPtr _obj
     return result'
@@ -4114,6 +4147,7 @@
 dateTimeAddMinutes _obj minutes = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_date_time_add_minutes _obj' minutes
+    checkUnexpectedReturnNULL "g_date_time_add_minutes" result
     result' <- (wrapBoxed DateTime) result
     touchManagedPtr _obj
     return result'
@@ -4141,6 +4175,7 @@
 dateTimeAddMonths _obj months = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_date_time_add_months _obj' months
+    checkUnexpectedReturnNULL "g_date_time_add_months" result
     result' <- (wrapBoxed DateTime) result
     touchManagedPtr _obj
     return result'
@@ -4169,6 +4204,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     let seconds' = realToFrac seconds
     result <- g_date_time_add_seconds _obj' seconds'
+    checkUnexpectedReturnNULL "g_date_time_add_seconds" result
     result' <- (wrapBoxed DateTime) result
     touchManagedPtr _obj
     return result'
@@ -4196,6 +4232,7 @@
 dateTimeAddWeeks _obj weeks = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_date_time_add_weeks _obj' weeks
+    checkUnexpectedReturnNULL "g_date_time_add_weeks" result
     result' <- (wrapBoxed DateTime) result
     touchManagedPtr _obj
     return result'
@@ -4223,6 +4260,7 @@
 dateTimeAddYears _obj years = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_date_time_add_years _obj' years
+    checkUnexpectedReturnNULL "g_date_time_add_years" result
     result' <- (wrapBoxed DateTime) result
     touchManagedPtr _obj
     return result'
@@ -4279,6 +4317,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     format' <- textToCString format
     result <- g_date_time_format _obj' format'
+    checkUnexpectedReturnNULL "g_date_time_format" result
     result' <- cstringToText result
     freeMem result
     touchManagedPtr _obj
@@ -4523,6 +4562,7 @@
 dateTimeGetTimezoneAbbreviation _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_date_time_get_timezone_abbreviation _obj'
+    checkUnexpectedReturnNULL "g_date_time_get_timezone_abbreviation" result
     result' <- cstringToText result
     touchManagedPtr _obj
     return result'
@@ -4705,6 +4745,7 @@
 dateTimeRef _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_date_time_ref _obj'
+    checkUnexpectedReturnNULL "g_date_time_ref" result
     result' <- (wrapBoxed DateTime) result
     touchManagedPtr _obj
     return result'
@@ -4730,6 +4771,7 @@
 dateTimeToLocal _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_date_time_to_local _obj'
+    checkUnexpectedReturnNULL "g_date_time_to_local" result
     result' <- (wrapBoxed DateTime) result
     touchManagedPtr _obj
     return result'
@@ -4787,6 +4829,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     let tz' = unsafeManagedPtrGetPtr tz
     result <- g_date_time_to_timezone _obj' tz'
+    checkUnexpectedReturnNULL "g_date_time_to_timezone" result
     result' <- (wrapBoxed DateTime) result
     touchManagedPtr _obj
     touchManagedPtr tz
@@ -4837,6 +4880,7 @@
 dateTimeToUtc _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_date_time_to_utc _obj'
+    checkUnexpectedReturnNULL "g_date_time_to_utc" result
     result' <- (wrapBoxed DateTime) result
     touchManagedPtr _obj
     return result'
@@ -4994,6 +5038,7 @@
 dirReadName _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_dir_read_name _obj'
+    checkUnexpectedReturnNULL "g_dir_read_name" result
     result' <- cstringToText result
     touchManagedPtr _obj
     return result'
@@ -5619,6 +5664,7 @@
 hmacGetString _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_hmac_get_string _obj'
+    checkUnexpectedReturnNULL "g_hmac_get_string" result
     result' <- cstringToText result
     touchManagedPtr _obj
     return result'
@@ -6201,6 +6247,7 @@
     mode' <- textToCString mode
     onException (do
         result <- propagateGError $ g_io_channel_new_file filename' mode'
+        checkUnexpectedReturnNULL "g_io_channel_new_file" result
         result' <- (wrapBoxed IOChannel) result
         freeMem filename'
         freeMem mode'
@@ -6230,6 +6277,7 @@
     m IOChannel
 iOChannelUnixNew fd = liftIO $ do
     result <- g_io_channel_unix_new fd
+    checkUnexpectedReturnNULL "g_io_channel_unix_new" result
     result' <- (wrapBoxed IOChannel) result
     return result'
 
@@ -6407,6 +6455,7 @@
 iOChannelGetEncoding _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_io_channel_get_encoding _obj'
+    checkUnexpectedReturnNULL "g_io_channel_get_encoding" result
     result' <- cstringToText result
     touchManagedPtr _obj
     return result'
@@ -6459,6 +6508,7 @@
 iOChannelGetLineTerm _obj length_ = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_io_channel_get_line_term _obj' length_
+    checkUnexpectedReturnNULL "g_io_channel_get_line_term" result
     result' <- cstringToText result
     touchManagedPtr _obj
     return result'
@@ -6663,6 +6713,7 @@
 iOChannelRef _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_io_channel_ref _obj'
+    checkUnexpectedReturnNULL "g_io_channel_ref" result
     result' <- (wrapBoxed IOChannel) result
     touchManagedPtr _obj
     return result'
@@ -7364,6 +7415,7 @@
     m KeyFile
 keyFileNew  = liftIO $ do
     result <- g_key_file_new
+    checkUnexpectedReturnNULL "g_key_file_new" result
     result' <- (wrapBoxed KeyFile) result
     return result'
 
@@ -7437,6 +7489,7 @@
     onException (do
         result <- propagateGError $ g_key_file_get_boolean_list _obj' group_name' key' length_
         length_' <- peek length_
+        checkUnexpectedReturnNULL "g_key_file_get_boolean_list" result
         result' <- (unpackMapStorableArrayWithLength (/= 0) length_') result
         freeMem result
         touchManagedPtr _obj
@@ -7483,6 +7536,7 @@
     key' <- textToCString key
     onException (do
         result <- propagateGError $ g_key_file_get_comment _obj' maybeGroup_name key'
+        checkUnexpectedReturnNULL "g_key_file_get_comment" result
         result' <- cstringToText result
         freeMem result
         touchManagedPtr _obj
@@ -7565,6 +7619,7 @@
     onException (do
         result <- propagateGError $ g_key_file_get_double_list _obj' group_name' key' length_
         length_' <- peek length_
+        checkUnexpectedReturnNULL "g_key_file_get_double_list" result
         result' <- (unpackMapStorableArrayWithLength realToFrac length_') result
         freeMem result
         touchManagedPtr _obj
@@ -7601,6 +7656,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     length_ <- allocMem :: IO (Ptr Word64)
     result <- g_key_file_get_groups _obj' length_
+    checkUnexpectedReturnNULL "g_key_file_get_groups" result
     result' <- unpackZeroTerminatedUTF8CArray result
     mapZeroTerminatedCArray freeMem result
     freeMem result
@@ -7717,6 +7773,7 @@
     onException (do
         result <- propagateGError $ g_key_file_get_integer_list _obj' group_name' key' length_
         length_' <- peek length_
+        checkUnexpectedReturnNULL "g_key_file_get_integer_list" result
         result' <- (unpackStorableArrayWithLength length_') result
         freeMem result
         touchManagedPtr _obj
@@ -7758,6 +7815,7 @@
     length_ <- allocMem :: IO (Ptr Word64)
     onException (do
         result <- propagateGError $ g_key_file_get_keys _obj' group_name' length_
+        checkUnexpectedReturnNULL "g_key_file_get_keys" result
         result' <- unpackZeroTerminatedUTF8CArray result
         mapZeroTerminatedCArray freeMem result
         freeMem result
@@ -7807,6 +7865,7 @@
             return jLocale'
     onException (do
         result <- propagateGError $ g_key_file_get_locale_string _obj' group_name' key' maybeLocale
+        checkUnexpectedReturnNULL "g_key_file_get_locale_string" result
         result' <- cstringToText result
         freeMem result
         touchManagedPtr _obj
@@ -7858,6 +7917,7 @@
     length_ <- allocMem :: IO (Ptr Word64)
     onException (do
         result <- propagateGError $ g_key_file_get_locale_string_list _obj' group_name' key' maybeLocale length_
+        checkUnexpectedReturnNULL "g_key_file_get_locale_string_list" result
         result' <- unpackZeroTerminatedUTF8CArray result
         mapZeroTerminatedCArray freeMem result
         freeMem result
@@ -7896,6 +7956,7 @@
 keyFileGetStartGroup _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_key_file_get_start_group _obj'
+    checkUnexpectedReturnNULL "g_key_file_get_start_group" result
     result' <- cstringToText result
     freeMem result
     touchManagedPtr _obj
@@ -7930,6 +7991,7 @@
     key' <- textToCString key
     onException (do
         result <- propagateGError $ g_key_file_get_string _obj' group_name' key'
+        checkUnexpectedReturnNULL "g_key_file_get_string" result
         result' <- cstringToText result
         freeMem result
         touchManagedPtr _obj
@@ -7972,6 +8034,7 @@
     length_ <- allocMem :: IO (Ptr Word64)
     onException (do
         result <- propagateGError $ g_key_file_get_string_list _obj' group_name' key' length_
+        checkUnexpectedReturnNULL "g_key_file_get_string_list" result
         result' <- unpackZeroTerminatedUTF8CArray result
         mapZeroTerminatedCArray freeMem result
         freeMem result
@@ -8054,6 +8117,7 @@
     key' <- textToCString key
     onException (do
         result <- propagateGError $ g_key_file_get_value _obj' group_name' key'
+        checkUnexpectedReturnNULL "g_key_file_get_value" result
         result' <- cstringToText result
         freeMem result
         touchManagedPtr _obj
@@ -8993,6 +9057,7 @@
     length_ <- allocMem :: IO (Ptr Word64)
     onException (do
         result <- propagateGError $ g_key_file_to_data _obj' length_
+        checkUnexpectedReturnNULL "g_key_file_to_data" result
         result' <- cstringToText result
         freeMem result
         length_' <- peek length_
@@ -9201,6 +9266,7 @@
     m MainContext
 mainContextNew  = liftIO $ do
     result <- g_main_context_new
+    checkUnexpectedReturnNULL "g_main_context_new" result
     result' <- (wrapBoxed MainContext) result
     return result'
 
@@ -9343,6 +9409,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     let funcs' = unsafeManagedPtrGetPtr funcs
     result <- g_main_context_find_source_by_funcs_user_data _obj' funcs' user_data
+    checkUnexpectedReturnNULL "g_main_context_find_source_by_funcs_user_data" result
     result' <- (newBoxed Source) result
     touchManagedPtr _obj
     touchManagedPtr funcs
@@ -9371,6 +9438,7 @@
 mainContextFindSourceById _obj source_id = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_main_context_find_source_by_id _obj' source_id
+    checkUnexpectedReturnNULL "g_main_context_find_source_by_id" result
     result' <- (newBoxed Source) result
     touchManagedPtr _obj
     return result'
@@ -9398,6 +9466,7 @@
 mainContextFindSourceByUserData _obj user_data = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_main_context_find_source_by_user_data _obj' user_data
+    checkUnexpectedReturnNULL "g_main_context_find_source_by_user_data" result
     result' <- (newBoxed Source) result
     touchManagedPtr _obj
     return result'
@@ -9649,6 +9718,7 @@
 mainContextRef _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_main_context_ref _obj'
+    checkUnexpectedReturnNULL "g_main_context_ref" result
     result' <- (wrapBoxed MainContext) result
     touchManagedPtr _obj
     return result'
@@ -9825,6 +9895,7 @@
             return jContext'
     let is_running' = (fromIntegral . fromEnum) is_running
     result <- g_main_loop_new maybeContext is_running'
+    checkUnexpectedReturnNULL "g_main_loop_new" result
     result' <- (wrapBoxed MainLoop) result
     whenJust context touchManagedPtr
     return result'
@@ -9850,6 +9921,7 @@
 mainLoopGetContext _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_main_loop_get_context _obj'
+    checkUnexpectedReturnNULL "g_main_loop_get_context" result
     result' <- (newBoxed MainContext) result
     touchManagedPtr _obj
     return result'
@@ -9924,6 +9996,7 @@
 mainLoopRef _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_main_loop_ref _obj'
+    checkUnexpectedReturnNULL "g_main_loop_ref" result
     result' <- (wrapBoxed MainLoop) result
     touchManagedPtr _obj
     return result'
@@ -10013,6 +10086,7 @@
     let writable' = (fromIntegral . fromEnum) writable
     onException (do
         result <- propagateGError $ g_mapped_file_new filename' writable'
+        checkUnexpectedReturnNULL "g_mapped_file_new" result
         result' <- (wrapBoxed MappedFile) result
         freeMem filename'
         return result'
@@ -10045,6 +10119,7 @@
     let writable' = (fromIntegral . fromEnum) writable
     onException (do
         result <- propagateGError $ g_mapped_file_new_from_fd fd writable'
+        checkUnexpectedReturnNULL "g_mapped_file_new_from_fd" result
         result' <- (wrapBoxed MappedFile) result
         return result'
      ) (do
@@ -10096,6 +10171,7 @@
 mappedFileGetBytes _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_mapped_file_get_bytes _obj'
+    checkUnexpectedReturnNULL "g_mapped_file_get_bytes" result
     result' <- (wrapBoxed Bytes) result
     touchManagedPtr _obj
     return result'
@@ -10121,6 +10197,7 @@
 mappedFileGetContents _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_mapped_file_get_contents _obj'
+    checkUnexpectedReturnNULL "g_mapped_file_get_contents" result
     result' <- cstringToText result
     freeMem result
     touchManagedPtr _obj
@@ -10171,6 +10248,7 @@
 mappedFileRef _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_mapped_file_ref _obj'
+    checkUnexpectedReturnNULL "g_mapped_file_ref" result
     result' <- (wrapBoxed MappedFile) result
     touchManagedPtr _obj
     return result'
@@ -10315,10 +10393,11 @@
 markupParseContextNew parser flags user_data user_data_dnotify = liftIO $ do
     let parser' = unsafeManagedPtrGetPtr parser
     let flags' = gflagsToWord flags
-    ptruser_data_dnotify <- callocBytes $ sizeOf (undefined :: FunPtr DestroyNotifyC)
+    ptruser_data_dnotify <- callocMem :: IO (Ptr (FunPtr DestroyNotifyC))
     user_data_dnotify' <- mkDestroyNotify (destroyNotifyWrapper (Just ptruser_data_dnotify) user_data_dnotify)
     poke ptruser_data_dnotify user_data_dnotify'
     result <- g_markup_parse_context_new parser' flags' user_data user_data_dnotify'
+    checkUnexpectedReturnNULL "g_markup_parse_context_new" result
     result' <- (wrapBoxed MarkupParseContext) result
     touchManagedPtr parser
     return result'
@@ -10397,6 +10476,7 @@
 markupParseContextGetElement _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_markup_parse_context_get_element _obj'
+    checkUnexpectedReturnNULL "g_markup_parse_context_get_element" result
     result' <- cstringToText result
     touchManagedPtr _obj
     return result'
@@ -10487,6 +10567,7 @@
 markupParseContextRef _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_markup_parse_context_ref _obj'
+    checkUnexpectedReturnNULL "g_markup_parse_context_ref" result
     result' <- (wrapBoxed MarkupParseContext) result
     touchManagedPtr _obj
     return result'
@@ -10592,6 +10673,7 @@
     string_to_expand' <- textToCString string_to_expand
     onException (do
         result <- propagateGError $ g_match_info_expand_references _obj' string_to_expand'
+        checkUnexpectedReturnNULL "g_match_info_expand_references" result
         result' <- cstringToText result
         freeMem result
         touchManagedPtr _obj
@@ -10624,6 +10706,7 @@
 matchInfoFetch _obj match_num = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_match_info_fetch _obj' match_num
+    checkUnexpectedReturnNULL "g_match_info_fetch" result
     result' <- cstringToText result
     freeMem result
     touchManagedPtr _obj
@@ -10650,6 +10733,7 @@
 matchInfoFetchAll _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_match_info_fetch_all _obj'
+    checkUnexpectedReturnNULL "g_match_info_fetch_all" result
     result' <- unpackZeroTerminatedUTF8CArray result
     mapZeroTerminatedCArray freeMem result
     freeMem result
@@ -10680,6 +10764,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     name' <- textToCString name
     result <- g_match_info_fetch_named _obj' name'
+    checkUnexpectedReturnNULL "g_match_info_fetch_named" result
     result' <- cstringToText result
     freeMem result
     touchManagedPtr _obj
@@ -10827,6 +10912,7 @@
 matchInfoGetRegex _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_match_info_get_regex _obj'
+    checkUnexpectedReturnNULL "g_match_info_get_regex" result
     result' <- (wrapBoxed Regex) result
     touchManagedPtr _obj
     return result'
@@ -10852,6 +10938,7 @@
 matchInfoGetString _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_match_info_get_string _obj'
+    checkUnexpectedReturnNULL "g_match_info_get_string" result
     result' <- cstringToText result
     touchManagedPtr _obj
     return result'
@@ -10956,6 +11043,7 @@
 matchInfoRef _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_match_info_ref _obj'
+    checkUnexpectedReturnNULL "g_match_info_ref" result
     result' <- (wrapBoxed MatchInfo) result
     touchManagedPtr _obj
     return result'
@@ -11728,6 +11816,7 @@
 optionContextGetDescription _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_option_context_get_description _obj'
+    checkUnexpectedReturnNULL "g_option_context_get_description" result
     result' <- cstringToText result
     touchManagedPtr _obj
     return result'
@@ -11763,6 +11852,7 @@
             let jGroup' = unsafeManagedPtrGetPtr jGroup
             return jGroup'
     result <- g_option_context_get_help _obj' main_help' maybeGroup
+    checkUnexpectedReturnNULL "g_option_context_get_help" result
     result' <- cstringToText result
     freeMem result
     touchManagedPtr _obj
@@ -11840,6 +11930,7 @@
 optionContextGetMainGroup _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_option_context_get_main_group _obj'
+    checkUnexpectedReturnNULL "g_option_context_get_main_group" result
     result' <- (newBoxed OptionGroup) result
     touchManagedPtr _obj
     return result'
@@ -11890,12 +11981,13 @@
 optionContextGetSummary _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_option_context_get_summary _obj'
+    checkUnexpectedReturnNULL "g_option_context_get_summary" result
     result' <- cstringToText result
     touchManagedPtr _obj
     return result'
 
 -- XXX Could not generate method OptionContext::parse
--- Error was : Bad introspection data: "argument \"argc\" is not of nullable type, but it is marked as such."
+-- Error was : Bad introspection data: "argument \"argc\" is not of nullable type (TBasicType TInt32), but it is marked as such."
 -- method OptionContext::parse_strv
 -- method type : OrdinaryMethod
 -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "OptionContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "arguments", argType = TCArray False (-1) (-1) (TBasicType TUTF8), direction = DirectionInout, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
@@ -12365,7 +12457,7 @@
         Nothing -> return nullPtr
         Just jUser_data -> do
             return jUser_data
-    ptrdestroy <- callocBytes $ sizeOf (undefined :: FunPtr DestroyNotifyC)
+    ptrdestroy <- callocMem :: IO (Ptr (FunPtr DestroyNotifyC))
     maybeDestroy <- case destroy of
         Nothing -> return (castPtrToFunPtr nullPtr)
         Just jDestroy -> do
@@ -12373,6 +12465,7 @@
             poke ptrdestroy jDestroy'
             return jDestroy'
     result <- g_option_group_new name' description' help_description' maybeUser_data maybeDestroy
+    checkUnexpectedReturnNULL "g_option_group_new" result
     result' <- (wrapBoxed OptionGroup) result
     freeMem name'
     freeMem description'
@@ -12452,6 +12545,7 @@
 optionGroupRef _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_option_group_ref _obj'
+    checkUnexpectedReturnNULL "g_option_group_ref" result
     result' <- (wrapBoxed OptionGroup) result
     touchManagedPtr _obj
     return result'
@@ -12844,7 +12938,7 @@
     m ()
 queueFreeFull _obj free_func = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
-    ptrfree_func <- callocBytes $ sizeOf (undefined :: FunPtr DestroyNotifyC)
+    ptrfree_func <- callocMem :: IO (Ptr (FunPtr DestroyNotifyC))
     free_func' <- mkDestroyNotify (destroyNotifyWrapper (Just ptrfree_func) free_func)
     poke ptrfree_func free_func'
     g_queue_free_full _obj' free_func'
@@ -13663,6 +13757,7 @@
     let match_options' = gflagsToWord match_options
     onException (do
         result <- propagateGError $ g_regex_new pattern' compile_options' match_options'
+        checkUnexpectedReturnNULL "g_regex_new" result
         result' <- (wrapBoxed Regex) result
         freeMem pattern'
         return result'
@@ -13838,6 +13933,7 @@
 regexGetPattern _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_regex_get_pattern _obj'
+    checkUnexpectedReturnNULL "g_regex_get_pattern" result
     result' <- cstringToText result
     touchManagedPtr _obj
     return result'
@@ -14061,6 +14157,7 @@
 regexRef _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_regex_ref _obj'
+    checkUnexpectedReturnNULL "g_regex_ref" result
     result' <- (wrapBoxed Regex) result
     touchManagedPtr _obj
     return result'
@@ -14101,6 +14198,7 @@
     let match_options' = gflagsToWord match_options
     onException (do
         result <- propagateGError $ g_regex_replace _obj' string' string_len start_position replacement' match_options'
+        checkUnexpectedReturnNULL "g_regex_replace" result
         result' <- cstringToText result
         freeMem result
         touchManagedPtr _obj
@@ -14150,6 +14248,7 @@
     let match_options' = gflagsToWord match_options
     onException (do
         result <- propagateGError $ g_regex_replace_literal _obj' string' string_len start_position replacement' match_options'
+        checkUnexpectedReturnNULL "g_regex_replace_literal" result
         result' <- cstringToText result
         freeMem result
         touchManagedPtr _obj
@@ -14190,6 +14289,7 @@
     string' <- textToCString string
     let match_options' = gflagsToWord match_options
     result <- g_regex_split _obj' string' match_options'
+    checkUnexpectedReturnNULL "g_regex_split" result
     result' <- unpackZeroTerminatedUTF8CArray result
     mapZeroTerminatedCArray freeMem result
     freeMem result
@@ -14232,6 +14332,7 @@
     let match_options' = gflagsToWord match_options
     onException (do
         result <- propagateGError $ g_regex_split_full _obj' string' string_len start_position match_options' max_tokens
+        checkUnexpectedReturnNULL "g_regex_split_full" result
         result' <- unpackZeroTerminatedUTF8CArray result
         mapZeroTerminatedCArray freeMem result
         freeMem result
@@ -15589,6 +15690,7 @@
 sourceNew source_funcs struct_size = liftIO $ do
     let source_funcs' = unsafeManagedPtrGetPtr source_funcs
     result <- g_source_new source_funcs' struct_size
+    checkUnexpectedReturnNULL "g_source_new" result
     result' <- (wrapBoxed Source) result
     touchManagedPtr source_funcs
     return result'
@@ -15751,6 +15853,7 @@
 sourceGetContext _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_source_get_context _obj'
+    checkUnexpectedReturnNULL "g_source_get_context" result
     result' <- (newBoxed MainContext) result
     touchManagedPtr _obj
     return result'
@@ -15828,6 +15931,7 @@
 sourceGetName _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_source_get_name _obj'
+    checkUnexpectedReturnNULL "g_source_get_name" result
     result' <- cstringToText result
     touchManagedPtr _obj
     return result'
@@ -16006,6 +16110,7 @@
 sourceRef _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_source_ref _obj'
+    checkUnexpectedReturnNULL "g_source_ref" result
     result' <- (wrapBoxed Source) result
     touchManagedPtr _obj
     return result'
@@ -16600,6 +16705,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     val' <- textToCString val
     result <- g_string_append _obj' val'
+    checkUnexpectedReturnNULL "g_string_append" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     freeMem val'
@@ -16628,6 +16734,7 @@
 stringAppendC _obj c = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_string_append_c _obj' c
+    checkUnexpectedReturnNULL "g_string_append_c" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     return result'
@@ -16658,6 +16765,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     val' <- textToCString val
     result <- g_string_append_len _obj' val' len
+    checkUnexpectedReturnNULL "g_string_append_len" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     freeMem val'
@@ -16687,6 +16795,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     let wc' = (fromIntegral . ord) wc
     result <- g_string_append_unichar _obj' wc'
+    checkUnexpectedReturnNULL "g_string_append_unichar" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     return result'
@@ -16721,6 +16830,7 @@
     reserved_chars_allowed' <- textToCString reserved_chars_allowed
     let allow_utf8' = (fromIntegral . fromEnum) allow_utf8
     result <- g_string_append_uri_escaped _obj' unescaped' reserved_chars_allowed' allow_utf8'
+    checkUnexpectedReturnNULL "g_string_append_uri_escaped" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     freeMem unescaped'
@@ -16748,6 +16858,7 @@
 stringAsciiDown _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_string_ascii_down _obj'
+    checkUnexpectedReturnNULL "g_string_ascii_down" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     return result'
@@ -16773,6 +16884,7 @@
 stringAsciiUp _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_string_ascii_up _obj'
+    checkUnexpectedReturnNULL "g_string_ascii_up" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     return result'
@@ -16801,6 +16913,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     rval' <- textToCString rval
     result <- g_string_assign _obj' rval'
+    checkUnexpectedReturnNULL "g_string_assign" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     freeMem rval'
@@ -16827,6 +16940,7 @@
 stringDown _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_string_down _obj'
+    checkUnexpectedReturnNULL "g_string_down" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     return result'
@@ -16885,6 +16999,7 @@
 stringErase _obj pos len = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_string_erase _obj' pos len
+    checkUnexpectedReturnNULL "g_string_erase" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     return result'
@@ -16913,6 +17028,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     let free_segment' = (fromIntegral . fromEnum) free_segment
     result <- g_string_free _obj' free_segment'
+    checkUnexpectedReturnNULL "g_string_free" result
     result' <- cstringToText result
     freeMem result
     touchManagedPtr _obj
@@ -16939,6 +17055,7 @@
 stringFreeToBytes _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_string_free_to_bytes _obj'
+    checkUnexpectedReturnNULL "g_string_free_to_bytes" result
     result' <- (wrapBoxed Bytes) result
     touchManagedPtr _obj
     return result'
@@ -16993,6 +17110,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     val' <- textToCString val
     result <- g_string_insert _obj' pos val'
+    checkUnexpectedReturnNULL "g_string_insert" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     freeMem val'
@@ -17023,6 +17141,7 @@
 stringInsertC _obj pos c = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_string_insert_c _obj' pos c
+    checkUnexpectedReturnNULL "g_string_insert_c" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     return result'
@@ -17055,6 +17174,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     val' <- textToCString val
     result <- g_string_insert_len _obj' pos val' len
+    checkUnexpectedReturnNULL "g_string_insert_len" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     freeMem val'
@@ -17086,6 +17206,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     let wc' = (fromIntegral . ord) wc
     result <- g_string_insert_unichar _obj' pos wc'
+    checkUnexpectedReturnNULL "g_string_insert_unichar" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     return result'
@@ -17116,6 +17237,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     val' <- textToCString val
     result <- g_string_overwrite _obj' pos val'
+    checkUnexpectedReturnNULL "g_string_overwrite" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     freeMem val'
@@ -17149,6 +17271,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     val' <- textToCString val
     result <- g_string_overwrite_len _obj' pos val' len
+    checkUnexpectedReturnNULL "g_string_overwrite_len" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     freeMem val'
@@ -17178,6 +17301,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     val' <- textToCString val
     result <- g_string_prepend _obj' val'
+    checkUnexpectedReturnNULL "g_string_prepend" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     freeMem val'
@@ -17206,6 +17330,7 @@
 stringPrependC _obj c = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_string_prepend_c _obj' c
+    checkUnexpectedReturnNULL "g_string_prepend_c" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     return result'
@@ -17236,6 +17361,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     val' <- textToCString val
     result <- g_string_prepend_len _obj' val' len
+    checkUnexpectedReturnNULL "g_string_prepend_len" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     freeMem val'
@@ -17265,6 +17391,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     let wc' = (fromIntegral . ord) wc
     result <- g_string_prepend_unichar _obj' wc'
+    checkUnexpectedReturnNULL "g_string_prepend_unichar" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     return result'
@@ -17292,6 +17419,7 @@
 stringSetSize _obj len = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_string_set_size _obj' len
+    checkUnexpectedReturnNULL "g_string_set_size" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     return result'
@@ -17319,6 +17447,7 @@
 stringTruncate _obj len = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_string_truncate _obj' len
+    checkUnexpectedReturnNULL "g_string_truncate" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     return result'
@@ -17344,6 +17473,7 @@
 stringUp _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_string_up _obj'
+    checkUnexpectedReturnNULL "g_string_up" result
     result' <- (wrapBoxed String) result
     touchManagedPtr _obj
     return result'
@@ -17425,6 +17555,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     string' <- textToCString string
     result <- g_string_chunk_insert _obj' string'
+    checkUnexpectedReturnNULL "g_string_chunk_insert" result
     result' <- cstringToText result
     freeMem result
     touchManagedPtr _obj
@@ -17455,6 +17586,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     string' <- textToCString string
     result <- g_string_chunk_insert_const _obj' string'
+    checkUnexpectedReturnNULL "g_string_chunk_insert_const" result
     result' <- cstringToText result
     freeMem result
     touchManagedPtr _obj
@@ -17487,6 +17619,7 @@
     let _obj' = unsafeManagedPtrGetPtr _obj
     string' <- textToCString string
     result <- g_string_chunk_insert_len _obj' string' len
+    checkUnexpectedReturnNULL "g_string_chunk_insert_len" result
     result' <- cstringToText result
     freeMem result
     touchManagedPtr _obj
@@ -17976,6 +18109,7 @@
 threadRef _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_thread_ref _obj'
+    checkUnexpectedReturnNULL "g_thread_ref" result
     result' <- (wrapBoxed Thread) result
     touchManagedPtr _obj
     return result'
@@ -18297,6 +18431,7 @@
 timeValToIso8601 _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_time_val_to_iso8601 _obj'
+    checkUnexpectedReturnNULL "g_time_val_to_iso8601" result
     result' <- cstringToText result
     freeMem result
     touchManagedPtr _obj
@@ -18338,6 +18473,7 @@
             jIdentifier' <- textToCString jIdentifier
             return jIdentifier'
     result <- g_time_zone_new maybeIdentifier
+    checkUnexpectedReturnNULL "g_time_zone_new" result
     result' <- (wrapBoxed TimeZone) result
     freeMem maybeIdentifier
     return result'
@@ -18360,6 +18496,7 @@
     m TimeZone
 timeZoneNewLocal  = liftIO $ do
     result <- g_time_zone_new_local
+    checkUnexpectedReturnNULL "g_time_zone_new_local" result
     result' <- (wrapBoxed TimeZone) result
     return result'
 
@@ -18381,6 +18518,7 @@
     m TimeZone
 timeZoneNewUtc  = liftIO $ do
     result <- g_time_zone_new_utc
+    checkUnexpectedReturnNULL "g_time_zone_new_utc" result
     result' <- (wrapBoxed TimeZone) result
     return result'
 
@@ -18465,6 +18603,7 @@
 timeZoneGetAbbreviation _obj interval = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_time_zone_get_abbreviation _obj' interval
+    checkUnexpectedReturnNULL "g_time_zone_get_abbreviation" result
     result' <- cstringToText result
     touchManagedPtr _obj
     return result'
@@ -18543,6 +18682,7 @@
 timeZoneRef _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_time_zone_ref _obj'
+    checkUnexpectedReturnNULL "g_time_zone_ref" result
     result' <- (wrapBoxed TimeZone) result
     touchManagedPtr _obj
     return result'
@@ -19976,6 +20116,7 @@
 variantBuilderNew type_ = liftIO $ do
     let type_' = unsafeManagedPtrGetPtr type_
     result <- g_variant_builder_new type_'
+    checkUnexpectedReturnNULL "g_variant_builder_new" result
     result' <- (wrapBoxed VariantBuilder) result
     touchManagedPtr type_
     return result'
@@ -20052,6 +20193,7 @@
 variantBuilderEnd _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_variant_builder_end _obj'
+    checkUnexpectedReturnNULL "g_variant_builder_end" result
     result' <- newGVariantFromPtr result
     touchManagedPtr _obj
     return result'
@@ -20105,6 +20247,7 @@
 variantBuilderRef _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_variant_builder_ref _obj'
+    checkUnexpectedReturnNULL "g_variant_builder_ref" result
     result' <- (wrapBoxed VariantBuilder) result
     touchManagedPtr _obj
     return result'
@@ -20234,6 +20377,7 @@
             let jFrom_asv' = unsafeManagedPtrGetPtr jFrom_asv
             return jFrom_asv'
     result <- g_variant_dict_new maybeFrom_asv
+    checkUnexpectedReturnNULL "g_variant_dict_new" result
     result' <- (wrapBoxed VariantDict) result
     return result'
 
@@ -20311,6 +20455,7 @@
 variantDictEnd _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_variant_dict_end _obj'
+    checkUnexpectedReturnNULL "g_variant_dict_end" result
     result' <- newGVariantFromPtr result
     touchManagedPtr _obj
     return result'
@@ -20377,6 +20522,7 @@
             let jExpected_type' = unsafeManagedPtrGetPtr jExpected_type
             return jExpected_type'
     result <- g_variant_dict_lookup_value _obj' key' maybeExpected_type
+    checkUnexpectedReturnNULL "g_variant_dict_lookup_value" result
     result' <- wrapGVariantPtr result
     touchManagedPtr _obj
     whenJust expected_type touchManagedPtr
@@ -20404,6 +20550,7 @@
 variantDictRef _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_variant_dict_ref _obj'
+    checkUnexpectedReturnNULL "g_variant_dict_ref" result
     result' <- (wrapBoxed VariantDict) result
     touchManagedPtr _obj
     return result'
@@ -20573,6 +20720,7 @@
 variantTypeNew type_string = liftIO $ do
     type_string' <- textToCString type_string
     result <- g_variant_type_new type_string'
+    checkUnexpectedReturnNULL "g_variant_type_new" result
     result' <- (wrapBoxed VariantType) result
     freeMem type_string'
     return result'
@@ -20598,6 +20746,7 @@
 variantTypeNewArray element = liftIO $ do
     let element' = unsafeManagedPtrGetPtr element
     result <- g_variant_type_new_array element'
+    checkUnexpectedReturnNULL "g_variant_type_new_array" result
     result' <- (wrapBoxed VariantType) result
     touchManagedPtr element
     return result'
@@ -20626,6 +20775,7 @@
     let key' = unsafeManagedPtrGetPtr key
     let value' = unsafeManagedPtrGetPtr value
     result <- g_variant_type_new_dict_entry key' value'
+    checkUnexpectedReturnNULL "g_variant_type_new_dict_entry" result
     result' <- (wrapBoxed VariantType) result
     touchManagedPtr key
     touchManagedPtr value
@@ -20652,6 +20802,7 @@
 variantTypeNewMaybe element = liftIO $ do
     let element' = unsafeManagedPtrGetPtr element
     result <- g_variant_type_new_maybe element'
+    checkUnexpectedReturnNULL "g_variant_type_new_maybe" result
     result' <- (wrapBoxed VariantType) result
     touchManagedPtr element
     return result'
@@ -20680,6 +20831,7 @@
     let items' = map unsafeManagedPtrGetPtr items
     items'' <- packPtrArray items'
     result <- g_variant_type_new_tuple items'' length_
+    checkUnexpectedReturnNULL "g_variant_type_new_tuple" result
     result' <- (wrapBoxed VariantType) result
     mapM_ touchManagedPtr items
     freeMem items''
@@ -20706,6 +20858,7 @@
 variantTypeCopy _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_variant_type_copy _obj'
+    checkUnexpectedReturnNULL "g_variant_type_copy" result
     result' <- (wrapBoxed VariantType) result
     touchManagedPtr _obj
     return result'
@@ -20731,6 +20884,7 @@
 variantTypeDupString _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_variant_type_dup_string _obj'
+    checkUnexpectedReturnNULL "g_variant_type_dup_string" result
     result' <- cstringToText result
     freeMem result
     touchManagedPtr _obj
@@ -20757,6 +20911,7 @@
 variantTypeElement _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_variant_type_element _obj'
+    checkUnexpectedReturnNULL "g_variant_type_element" result
     result' <- (newBoxed VariantType) result
     touchManagedPtr _obj
     return result'
@@ -20811,6 +20966,7 @@
 variantTypeFirst _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_variant_type_first _obj'
+    checkUnexpectedReturnNULL "g_variant_type_first" result
     result' <- (newBoxed VariantType) result
     touchManagedPtr _obj
     return result'
@@ -21137,6 +21293,7 @@
 variantTypeKey _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_variant_type_key _obj'
+    checkUnexpectedReturnNULL "g_variant_type_key" result
     result' <- (newBoxed VariantType) result
     touchManagedPtr _obj
     return result'
@@ -21186,6 +21343,7 @@
 variantTypeNext _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_variant_type_next _obj'
+    checkUnexpectedReturnNULL "g_variant_type_next" result
     result' <- (newBoxed VariantType) result
     touchManagedPtr _obj
     return result'
@@ -21211,6 +21369,7 @@
 variantTypeValue _obj = liftIO $ do
     let _obj' = unsafeManagedPtrGetPtr _obj
     result <- g_variant_type_value _obj'
+    checkUnexpectedReturnNULL "g_variant_type_value" result
     result' <- (newBoxed VariantType) result
     touchManagedPtr _obj
     return result'
@@ -21831,6 +21990,7 @@
     buffer' <- textToCString buffer
     let d' = realToFrac d
     result <- g_ascii_dtostr buffer' buf_len d'
+    checkUnexpectedReturnNULL "g_ascii_dtostr" result
     result' <- cstringToText result
     freeMem result
     freeMem buffer'
@@ -21864,6 +22024,7 @@
     format' <- textToCString format
     let d' = realToFrac d
     result <- g_ascii_formatd buffer' buf_len format' d'
+    checkUnexpectedReturnNULL "g_ascii_formatd" result
     result' <- cstringToText result
     freeMem result
     freeMem buffer'
@@ -21919,6 +22080,7 @@
 asciiStrdown str len = liftIO $ do
     str' <- textToCString str
     result <- g_ascii_strdown str' len
+    checkUnexpectedReturnNULL "g_ascii_strdown" result
     result' <- cstringToText result
     freeMem result
     freeMem str'
@@ -22061,6 +22223,7 @@
 asciiStrup str len = liftIO $ do
     str' <- textToCString str
     result <- g_ascii_strup str' len
+    checkUnexpectedReturnNULL "g_ascii_strup" result
     result' <- cstringToText result
     freeMem result
     freeMem str'
@@ -22352,7 +22515,7 @@
     VoidFunc ->                             -- func
     m ()
 atexit func = liftIO $ do
-    ptrfunc <- callocBytes $ sizeOf (undefined :: FunPtr VoidFuncC)
+    ptrfunc <- callocMem :: IO (Ptr (FunPtr VoidFuncC))
     func' <- mkVoidFunc (voidFuncWrapper (Just ptrfunc) func)
     poke ptrfunc func'
     g_atexit func'
@@ -22750,6 +22913,7 @@
     out_len <- allocMem :: IO (Ptr Word64)
     result <- g_base64_decode text' out_len
     out_len' <- peek out_len
+    checkUnexpectedReturnNULL "g_base64_decode" result
     result' <- (unpackByteStringWithLength out_len') result
     freeMem result
     freeMem text'
@@ -22812,6 +22976,7 @@
     let len = fromIntegral $ B.length data_
     data_' <- packByteString data_
     result <- g_base64_encode data_' len
+    checkUnexpectedReturnNULL "g_base64_encode" result
     result' <- cstringToText result
     freeMem result
     freeMem data_'
@@ -22837,6 +23002,7 @@
 basename file_name = liftIO $ do
     file_name' <- textToCString file_name
     result <- g_basename file_name'
+    checkUnexpectedReturnNULL "g_basename" result
     result' <- cstringToText result
     freeMem file_name'
     return result'
@@ -23017,6 +23183,7 @@
 buildFilenamev args = liftIO $ do
     args' <- packZeroTerminatedUTF8CArray args
     result <- g_build_filenamev args'
+    checkUnexpectedReturnNULL "g_build_filenamev" result
     result' <- cstringToText result
     freeMem result
     mapZeroTerminatedCArray freeMem args'
@@ -23046,6 +23213,7 @@
     separator' <- textToCString separator
     args' <- packZeroTerminatedUTF8CArray args
     result <- g_build_pathv separator' args'
+    checkUnexpectedReturnNULL "g_build_pathv" result
     result' <- cstringToText result
     freeMem result
     freeMem separator'
@@ -23099,6 +23267,7 @@
 byteArrayFreeToBytes array = liftIO $ do
     array' <- packGByteArray array
     result <- g_byte_array_free_to_bytes array'
+    checkUnexpectedReturnNULL "g_byte_array_free_to_bytes" result
     result' <- (wrapBoxed Bytes) result
     return result'
 
@@ -23119,6 +23288,7 @@
     m ByteString
 byteArrayNew  = liftIO $ do
     result <- g_byte_array_new
+    checkUnexpectedReturnNULL "g_byte_array_new" result
     result' <- unpackGByteArray result
     unrefGByteArray result
     return result'
@@ -23145,6 +23315,7 @@
     let len = fromIntegral $ B.length data_
     data_' <- packByteString data_
     result <- g_byte_array_new_take data_' len
+    checkUnexpectedReturnNULL "g_byte_array_new_take" result
     result' <- unpackGByteArray result
     unrefGByteArray result
     return result'
@@ -23218,6 +23389,7 @@
     m T.Text
 checkVersion required_major required_minor required_micro = liftIO $ do
     result <- glib_check_version required_major required_minor required_micro
+    checkUnexpectedReturnNULL "glib_check_version" result
     result' <- cstringToText result
     return result'
 
@@ -23292,6 +23464,7 @@
     m Source
 childWatchSourceNew pid = liftIO $ do
     result <- g_child_watch_source_new pid
+    checkUnexpectedReturnNULL "g_child_watch_source_new" result
     result' <- (wrapBoxed Source) result
     return result'
 
@@ -23368,6 +23541,7 @@
     let checksum_type' = (fromIntegral . fromEnum) checksum_type
     let data_' = unsafeManagedPtrGetPtr data_
     result <- g_compute_checksum_for_bytes checksum_type' data_'
+    checkUnexpectedReturnNULL "g_compute_checksum_for_bytes" result
     result' <- cstringToText result
     freeMem result
     touchManagedPtr data_
@@ -23398,6 +23572,7 @@
     let checksum_type' = (fromIntegral . fromEnum) checksum_type
     data_' <- packByteString data_
     result <- g_compute_checksum_for_data checksum_type' data_' length_
+    checkUnexpectedReturnNULL "g_compute_checksum_for_data" result
     result' <- cstringToText result
     freeMem result
     freeMem data_'
@@ -23428,6 +23603,7 @@
     let checksum_type' = (fromIntegral . fromEnum) checksum_type
     str' <- textToCString str
     result <- g_compute_checksum_for_string checksum_type' str' length_
+    checkUnexpectedReturnNULL "g_compute_checksum_for_string" result
     result' <- cstringToText result
     freeMem result
     freeMem str'
@@ -23462,6 +23638,7 @@
     let digest_type' = (fromIntegral . fromEnum) digest_type
     key' <- packByteString key
     result <- g_compute_hmac_for_data digest_type' key' key_len data_ length_
+    checkUnexpectedReturnNULL "g_compute_hmac_for_data" result
     result' <- cstringToText result
     freeMem result
     freeMem key'
@@ -23497,6 +23674,7 @@
     key' <- packByteString key
     str' <- textToCString str
     result <- g_compute_hmac_for_string digest_type' key' key_len str' length_
+    checkUnexpectedReturnNULL "g_compute_hmac_for_string" result
     result' <- cstringToText result
     freeMem result
     freeMem key'
@@ -23537,6 +23715,7 @@
     bytes_written <- allocMem :: IO (Ptr Word64)
     onException (do
         result <- propagateGError $ g_convert str' len to_codeset' from_codeset' bytes_read bytes_written
+        checkUnexpectedReturnNULL "g_convert" result
         result' <- cstringToText result
         freeMem result
         bytes_read' <- peek bytes_read
@@ -23611,6 +23790,7 @@
     fallback' <- textToCString fallback
     onException (do
         result <- propagateGError $ g_convert_with_fallback str' len to_codeset' from_codeset' fallback' bytes_read bytes_written
+        checkUnexpectedReturnNULL "g_convert_with_fallback" result
         result' <- cstringToText result
         freeMem result
         freeMem str'
@@ -23656,6 +23836,7 @@
     let converter' = unsafeManagedPtrGetPtr converter
     onException (do
         result <- propagateGError $ g_convert_with_iconv str' len converter' bytes_read bytes_written
+        checkUnexpectedReturnNULL "g_convert_with_iconv" result
         result' <- cstringToText result
         freeMem result
         touchManagedPtr converter
@@ -23748,14 +23929,14 @@
         Nothing -> return nullPtr
         Just jNewval -> do
             return jNewval
-    ptrdestroy <- callocBytes $ sizeOf (undefined :: FunPtr DestroyNotifyC)
+    ptrdestroy <- callocMem :: IO (Ptr (FunPtr DestroyNotifyC))
     maybeDestroy <- case destroy of
         Nothing -> return (castPtrToFunPtr nullPtr)
         Just jDestroy -> do
             jDestroy' <- mkDestroyNotify (destroyNotifyWrapper (Just ptrdestroy) jDestroy)
             poke ptrdestroy jDestroy'
             return jDestroy'
-    ptrold_destroy <- callocBytes $ sizeOf (undefined :: FunPtr DestroyNotifyC)
+    ptrold_destroy <- callocMem :: IO (Ptr (FunPtr DestroyNotifyC))
     maybeOld_destroy <- case old_destroy of
         Nothing -> return (castPtrToFunPtr nullPtr)
         Just jOld_destroy -> do
@@ -23796,7 +23977,7 @@
         Nothing -> return nullPtr
         Just jData_ -> do
             return jData_
-    ptrdestroy_func <- callocBytes $ sizeOf (undefined :: FunPtr DestroyNotifyC)
+    ptrdestroy_func <- callocMem :: IO (Ptr (FunPtr DestroyNotifyC))
     destroy_func' <- mkDestroyNotify (destroyNotifyWrapper (Just ptrdestroy_func) destroy_func)
     poke ptrdestroy_func destroy_func'
     g_datalist_id_set_data_full datalist' key_id maybeData_ destroy_func'
@@ -23921,7 +24102,7 @@
     DestroyNotify ->                        -- destroy_func
     m ()
 datasetIdSetDataFull dataset_location key_id data_ destroy_func = liftIO $ do
-    ptrdestroy_func <- callocBytes $ sizeOf (undefined :: FunPtr DestroyNotifyC)
+    ptrdestroy_func <- callocMem :: IO (Ptr (FunPtr DestroyNotifyC))
     destroy_func' <- mkDestroyNotify (destroyNotifyWrapper (Just ptrdestroy_func) destroy_func)
     poke ptrdestroy_func destroy_func'
     g_dataset_id_set_data_full dataset_location key_id data_ destroy_func'
@@ -24284,6 +24465,7 @@
             return jDomain'
     msgid' <- textToCString msgid
     result <- g_dcgettext maybeDomain msgid' category
+    checkUnexpectedReturnNULL "g_dcgettext" result
     result' <- cstringToText result
     freeMem maybeDomain
     freeMem msgid'
@@ -24316,6 +24498,7 @@
             return jDomain'
     msgid' <- textToCString msgid
     result <- g_dgettext maybeDomain msgid'
+    checkUnexpectedReturnNULL "g_dgettext" result
     result' <- cstringToText result
     freeMem maybeDomain
     freeMem msgid'
@@ -24347,6 +24530,7 @@
             return jTmpl'
     onException (do
         result <- propagateGError $ g_dir_make_tmp maybeTmpl
+        checkUnexpectedReturnNULL "g_dir_make_tmp" result
         result' <- cstringToString result
         freeMem result
         freeMem maybeTmpl
@@ -24444,6 +24628,7 @@
     msgid' <- textToCString msgid
     msgid_plural' <- textToCString msgid_plural
     result <- g_dngettext maybeDomain msgid' msgid_plural' n
+    checkUnexpectedReturnNULL "g_dngettext" result
     result' <- cstringToText result
     freeMem maybeDomain
     freeMem msgid'
@@ -24524,6 +24709,7 @@
             return jDomain'
     msgctxtid' <- textToCString msgctxtid
     result <- g_dpgettext maybeDomain msgctxtid' msgidoffset
+    checkUnexpectedReturnNULL "g_dpgettext" result
     result' <- cstringToText result
     freeMem maybeDomain
     freeMem msgctxtid'
@@ -24559,6 +24745,7 @@
     context' <- textToCString context
     msgid' <- textToCString msgid
     result <- g_dpgettext2 maybeDomain context' msgid'
+    checkUnexpectedReturnNULL "g_dpgettext2" result
     result' <- cstringToText result
     freeMem maybeDomain
     freeMem context'
@@ -24592,6 +24779,7 @@
             return jEnvp'
     variable' <- textToCString variable
     result <- g_environ_getenv maybeEnvp variable'
+    checkUnexpectedReturnNULL "g_environ_getenv" result
     result' <- cstringToText result
     mapZeroTerminatedCArray freeMem maybeEnvp
     freeMem maybeEnvp
@@ -24631,6 +24819,7 @@
     value' <- textToCString value
     let overwrite' = (fromIntegral . fromEnum) overwrite
     result <- g_environ_setenv maybeEnvp variable' value' overwrite'
+    checkUnexpectedReturnNULL "g_environ_setenv" result
     result' <- unpackZeroTerminatedUTF8CArray result
     mapZeroTerminatedCArray freeMem result
     freeMem result
@@ -24665,6 +24854,7 @@
             return jEnvp'
     variable' <- textToCString variable
     result <- g_environ_unsetenv maybeEnvp variable'
+    checkUnexpectedReturnNULL "g_environ_unsetenv" result
     result' <- unpackZeroTerminatedUTF8CArray result
     mapZeroTerminatedCArray freeMem result
     freeMem result
@@ -24813,6 +25003,7 @@
     filename' <- textToCString filename
     onException (do
         result <- propagateGError $ g_file_read_link filename'
+        checkUnexpectedReturnNULL "g_file_read_link" result
         result' <- cstringToText result
         freeMem result
         freeMem filename'
@@ -24903,6 +25094,7 @@
 filenameDisplayBasename filename = liftIO $ do
     filename' <- textToCString filename
     result <- g_filename_display_basename filename'
+    checkUnexpectedReturnNULL "g_filename_display_basename" result
     result' <- cstringToText result
     freeMem result
     freeMem filename'
@@ -24928,6 +25120,7 @@
 filenameDisplayName filename = liftIO $ do
     filename' <- textToCString filename
     result <- g_filename_display_name filename'
+    checkUnexpectedReturnNULL "g_filename_display_name" result
     result' <- cstringToText result
     freeMem result
     freeMem filename'
@@ -24957,6 +25150,7 @@
     hostname <- allocMem :: IO (Ptr CString)
     onException (do
         result <- propagateGError $ g_filename_from_uri uri' hostname
+        checkUnexpectedReturnNULL "g_filename_from_uri" result
         result' <- cstringToString result
         freeMem result
         hostname' <- peek hostname
@@ -24999,6 +25193,7 @@
     onException (do
         result <- propagateGError $ g_filename_from_utf8 utf8string' len bytes_read bytes_written
         bytes_written' <- peek bytes_written
+        checkUnexpectedReturnNULL "g_filename_from_utf8" result
         result' <- (unpackByteStringWithLength bytes_written') result
         freeMem result
         bytes_read' <- peek bytes_read
@@ -25041,6 +25236,7 @@
             return jHostname'
     onException (do
         result <- propagateGError $ g_filename_to_uri filename' maybeHostname
+        checkUnexpectedReturnNULL "g_filename_to_uri" result
         result' <- cstringToText result
         freeMem result
         freeMem filename'
@@ -25079,6 +25275,7 @@
     opsysstring' <- textToCString opsysstring
     onException (do
         result <- propagateGError $ g_filename_to_utf8 opsysstring' len bytes_read bytes_written
+        checkUnexpectedReturnNULL "g_filename_to_utf8" result
         result' <- cstringToText result
         freeMem result
         freeMem opsysstring'
@@ -25107,6 +25304,7 @@
 findProgramInPath program = liftIO $ do
     program' <- textToCString program
     result <- g_find_program_in_path program'
+    checkUnexpectedReturnNULL "g_find_program_in_path" result
     result' <- cstringToText result
     freeMem result
     freeMem program'
@@ -25131,6 +25329,7 @@
     m T.Text
 formatSize size = liftIO $ do
     result <- g_format_size size
+    checkUnexpectedReturnNULL "g_format_size" result
     result' <- cstringToText result
     freeMem result
     return result'
@@ -25154,6 +25353,7 @@
     m T.Text
 formatSizeForDisplay size = liftIO $ do
     result <- g_format_size_for_display size
+    checkUnexpectedReturnNULL "g_format_size_for_display" result
     result' <- cstringToText result
     freeMem result
     return result'
@@ -25180,6 +25380,7 @@
 formatSizeFull size flags = liftIO $ do
     let flags' = gflagsToWord flags
     result <- g_format_size_full size flags'
+    checkUnexpectedReturnNULL "g_format_size_full" result
     result' <- cstringToText result
     freeMem result
     return result'
@@ -25226,6 +25427,7 @@
     m T.Text
 getApplicationName  = liftIO $ do
     result <- g_get_application_name
+    checkUnexpectedReturnNULL "g_get_application_name" result
     result' <- cstringToText result
     return result'
 
@@ -25271,6 +25473,7 @@
     m T.Text
 getCodeset  = liftIO $ do
     result <- g_get_codeset
+    checkUnexpectedReturnNULL "g_get_codeset" result
     result' <- cstringToText result
     freeMem result
     return result'
@@ -25292,6 +25495,7 @@
     m T.Text
 getCurrentDir  = liftIO $ do
     result <- g_get_current_dir
+    checkUnexpectedReturnNULL "g_get_current_dir" result
     result' <- cstringToText result
     freeMem result
     return result'
@@ -25336,6 +25540,7 @@
     m [T.Text]
 getEnviron  = liftIO $ do
     result <- g_get_environ
+    checkUnexpectedReturnNULL "g_get_environ" result
     result' <- unpackZeroTerminatedUTF8CArray result
     mapZeroTerminatedCArray freeMem result
     freeMem result
@@ -25382,6 +25587,7 @@
     m T.Text
 getHomeDir  = liftIO $ do
     result <- g_get_home_dir
+    checkUnexpectedReturnNULL "g_get_home_dir" result
     result' <- cstringToText result
     return result'
 
@@ -25402,6 +25608,7 @@
     m T.Text
 getHostName  = liftIO $ do
     result <- g_get_host_name
+    checkUnexpectedReturnNULL "g_get_host_name" result
     result' <- cstringToText result
     return result'
 
@@ -25422,6 +25629,7 @@
     m [T.Text]
 getLanguageNames  = liftIO $ do
     result <- g_get_language_names
+    checkUnexpectedReturnNULL "g_get_language_names" result
     result' <- unpackZeroTerminatedUTF8CArray result
     return result'
 
@@ -25445,6 +25653,7 @@
 getLocaleVariants locale = liftIO $ do
     locale' <- textToCString locale
     result <- g_get_locale_variants locale'
+    checkUnexpectedReturnNULL "g_get_locale_variants" result
     result' <- unpackZeroTerminatedUTF8CArray result
     mapZeroTerminatedCArray freeMem result
     freeMem result
@@ -25506,6 +25715,7 @@
     m T.Text
 getPrgname  = liftIO $ do
     result <- g_get_prgname
+    checkUnexpectedReturnNULL "g_get_prgname" result
     result' <- cstringToText result
     return result'
 
@@ -25526,6 +25736,7 @@
     m T.Text
 getRealName  = liftIO $ do
     result <- g_get_real_name
+    checkUnexpectedReturnNULL "g_get_real_name" result
     result' <- cstringToText result
     return result'
 
@@ -25565,6 +25776,7 @@
     m [T.Text]
 getSystemConfigDirs  = liftIO $ do
     result <- g_get_system_config_dirs
+    checkUnexpectedReturnNULL "g_get_system_config_dirs" result
     result' <- unpackZeroTerminatedUTF8CArray result
     return result'
 
@@ -25585,6 +25797,7 @@
     m [T.Text]
 getSystemDataDirs  = liftIO $ do
     result <- g_get_system_data_dirs
+    checkUnexpectedReturnNULL "g_get_system_data_dirs" result
     result' <- unpackZeroTerminatedUTF8CArray result
     return result'
 
@@ -25605,6 +25818,7 @@
     m T.Text
 getTmpDir  = liftIO $ do
     result <- g_get_tmp_dir
+    checkUnexpectedReturnNULL "g_get_tmp_dir" result
     result' <- cstringToText result
     return result'
 
@@ -25625,6 +25839,7 @@
     m T.Text
 getUserCacheDir  = liftIO $ do
     result <- g_get_user_cache_dir
+    checkUnexpectedReturnNULL "g_get_user_cache_dir" result
     result' <- cstringToText result
     return result'
 
@@ -25645,6 +25860,7 @@
     m T.Text
 getUserConfigDir  = liftIO $ do
     result <- g_get_user_config_dir
+    checkUnexpectedReturnNULL "g_get_user_config_dir" result
     result' <- cstringToText result
     return result'
 
@@ -25665,6 +25881,7 @@
     m T.Text
 getUserDataDir  = liftIO $ do
     result <- g_get_user_data_dir
+    checkUnexpectedReturnNULL "g_get_user_data_dir" result
     result' <- cstringToText result
     return result'
 
@@ -25685,6 +25902,7 @@
     m T.Text
 getUserName  = liftIO $ do
     result <- g_get_user_name
+    checkUnexpectedReturnNULL "g_get_user_name" result
     result' <- cstringToText result
     return result'
 
@@ -25705,6 +25923,7 @@
     m T.Text
 getUserRuntimeDir  = liftIO $ do
     result <- g_get_user_runtime_dir
+    checkUnexpectedReturnNULL "g_get_user_runtime_dir" result
     result' <- cstringToText result
     return result'
 
@@ -25728,6 +25947,7 @@
 getUserSpecialDir directory = liftIO $ do
     let directory' = (fromIntegral . fromEnum) directory
     result <- g_get_user_special_dir directory'
+    checkUnexpectedReturnNULL "g_get_user_special_dir" result
     result' <- cstringToText result
     return result'
 
@@ -25751,6 +25971,7 @@
 getenv variable = liftIO $ do
     variable' <- textToCString variable
     result <- g_getenv variable'
+    checkUnexpectedReturnNULL "g_getenv" result
     result' <- cstringToText result
     freeMem variable'
     return result'
@@ -26361,6 +26582,7 @@
 hostnameToAscii hostname = liftIO $ do
     hostname' <- textToCString hostname
     result <- g_hostname_to_ascii hostname'
+    checkUnexpectedReturnNULL "g_hostname_to_ascii" result
     result' <- cstringToText result
     freeMem result
     freeMem hostname'
@@ -26386,6 +26608,7 @@
 hostnameToUnicode hostname = liftIO $ do
     hostname' <- textToCString hostname
     result <- g_hostname_to_unicode hostname'
+    checkUnexpectedReturnNULL "g_hostname_to_unicode" result
     result' <- cstringToText result
     freeMem result
     freeMem hostname'
@@ -26493,6 +26716,7 @@
     m Source
 idleSourceNew  = liftIO $ do
     result <- g_idle_source_new
+    checkUnexpectedReturnNULL "g_idle_source_new" result
     result' <- (wrapBoxed Source) result
     return result'
 
@@ -26610,6 +26834,7 @@
             jString' <- textToCString jString
             return jString'
     result <- g_intern_static_string maybeString
+    checkUnexpectedReturnNULL "g_intern_static_string" result
     result' <- cstringToText result
     freeMem maybeString
     return result'
@@ -26638,6 +26863,7 @@
             jString' <- textToCString jString
             return jString'
     result <- g_intern_string maybeString
+    checkUnexpectedReturnNULL "g_intern_string" result
     result' <- cstringToText result
     freeMem maybeString
     return result'
@@ -26741,6 +26967,7 @@
     let channel' = unsafeManagedPtrGetPtr channel
     let condition' = gflagsToWord condition
     result <- g_io_create_watch channel' condition'
+    checkUnexpectedReturnNULL "g_io_create_watch" result
     result' <- (wrapBoxed Source) result
     touchManagedPtr channel
     return result'
@@ -26781,6 +27008,7 @@
     m [T.Text]
 listenv  = liftIO $ do
     result <- g_listenv
+    checkUnexpectedReturnNULL "g_listenv" result
     result' <- unpackZeroTerminatedUTF8CArray result
     mapZeroTerminatedCArray freeMem result
     freeMem result
@@ -26814,6 +27042,7 @@
     utf8string' <- textToCString utf8string
     onException (do
         result <- propagateGError $ g_locale_from_utf8 utf8string' len bytes_read bytes_written
+        checkUnexpectedReturnNULL "g_locale_from_utf8" result
         result' <- cstringToText result
         freeMem result
         freeMem utf8string'
@@ -26850,6 +27079,7 @@
     opsysstring' <- textToCString opsysstring
     onException (do
         result <- propagateGError $ g_locale_to_utf8 opsysstring' len bytes_read bytes_written
+        checkUnexpectedReturnNULL "g_locale_to_utf8" result
         result' <- cstringToText result
         freeMem result
         freeMem opsysstring'
@@ -26982,6 +27212,7 @@
     m MainContext
 mainContextDefault  = liftIO $ do
     result <- g_main_context_default
+    checkUnexpectedReturnNULL "g_main_context_default" result
     result' <- (newBoxed MainContext) result
     return result'
 
@@ -27002,6 +27233,7 @@
     m MainContext
 mainContextGetThreadDefault  = liftIO $ do
     result <- g_main_context_get_thread_default
+    checkUnexpectedReturnNULL "g_main_context_get_thread_default" result
     result' <- (newBoxed MainContext) result
     return result'
 
@@ -27022,6 +27254,7 @@
     m MainContext
 mainContextRefThreadDefault  = liftIO $ do
     result <- g_main_context_ref_thread_default
+    checkUnexpectedReturnNULL "g_main_context_ref_thread_default" result
     result' <- (wrapBoxed MainContext) result
     return result'
 
@@ -27042,6 +27275,7 @@
     m Source
 mainCurrentSource  = liftIO $ do
     result <- g_main_current_source
+    checkUnexpectedReturnNULL "g_main_current_source" result
     result' <- (newBoxed Source) result
     return result'
 
@@ -27105,6 +27339,7 @@
 markupEscapeText text length_ = liftIO $ do
     text' <- textToCString text
     result <- g_markup_escape_text text' length_
+    checkUnexpectedReturnNULL "g_markup_escape_text" result
     result' <- cstringToText result
     freeMem result
     freeMem text'
@@ -27217,6 +27452,7 @@
 mkdtemp tmpl = liftIO $ do
     tmpl' <- stringToCString tmpl
     result <- g_mkdtemp tmpl'
+    checkUnexpectedReturnNULL "g_mkdtemp" result
     result' <- cstringToText result
     freeMem result
     freeMem tmpl'
@@ -27244,6 +27480,7 @@
 mkdtempFull tmpl mode = liftIO $ do
     tmpl' <- stringToCString tmpl
     result <- g_mkdtemp_full tmpl' mode
+    checkUnexpectedReturnNULL "g_mkdtemp_full" result
     result' <- cstringToText result
     freeMem result
     freeMem tmpl'
@@ -27485,6 +27722,7 @@
 pathGetBasename file_name = liftIO $ do
     file_name' <- textToCString file_name
     result <- g_path_get_basename file_name'
+    checkUnexpectedReturnNULL "g_path_get_basename" result
     result' <- cstringToText result
     freeMem result
     freeMem file_name'
@@ -27510,6 +27748,7 @@
 pathGetDirname file_name = liftIO $ do
     file_name' <- textToCString file_name
     result <- g_path_get_dirname file_name'
+    checkUnexpectedReturnNULL "g_path_get_dirname" result
     result' <- cstringToText result
     freeMem result
     freeMem file_name'
@@ -27559,6 +27798,7 @@
 pathSkipRoot file_name = liftIO $ do
     file_name' <- textToCString file_name
     result <- g_path_skip_root file_name'
+    checkUnexpectedReturnNULL "g_path_skip_root" result
     result' <- cstringToText result
     freeMem file_name'
     return result'
@@ -27854,6 +28094,7 @@
     m T.Text
 quarkToString quark = liftIO $ do
     result <- g_quark_to_string quark
+    checkUnexpectedReturnNULL "g_quark_to_string" result
     result' <- cstringToText result
     return result'
 
@@ -28068,6 +28309,7 @@
 regexEscapeNul string length_ = liftIO $ do
     string' <- textToCString string
     result <- g_regex_escape_nul string' length_
+    checkUnexpectedReturnNULL "g_regex_escape_nul" result
     result' <- cstringToText result
     freeMem result
     freeMem string'
@@ -28095,6 +28337,7 @@
     let length_ = fromIntegral $ length string
     string' <- packUTF8CArray string
     result <- g_regex_escape_string string' length_
+    checkUnexpectedReturnNULL "g_regex_escape_string" result
     result' <- cstringToText result
     freeMem result
     (mapCArrayWithLength length_) freeMem string'
@@ -28164,6 +28407,7 @@
     let compile_options' = gflagsToWord compile_options
     let match_options' = gflagsToWord match_options
     result <- g_regex_split_simple pattern' string' compile_options' match_options'
+    checkUnexpectedReturnNULL "g_regex_split_simple" result
     result' <- unpackZeroTerminatedUTF8CArray result
     mapZeroTerminatedCArray freeMem result
     freeMem result
@@ -28596,6 +28840,7 @@
 shellQuote unquoted_string = liftIO $ do
     unquoted_string' <- textToCString unquoted_string
     result <- g_shell_quote unquoted_string'
+    checkUnexpectedReturnNULL "g_shell_quote" result
     result' <- cstringToText result
     freeMem result
     freeMem unquoted_string'
@@ -28623,6 +28868,7 @@
     quoted_string' <- textToCString quoted_string
     onException (do
         result <- propagateGError $ g_shell_unquote quoted_string'
+        checkUnexpectedReturnNULL "g_shell_unquote" result
         result' <- cstringToText result
         freeMem result
         freeMem quoted_string'
@@ -28908,7 +29154,7 @@
             jEnvp' <- packZeroTerminatedUTF8CArray jEnvp
             return jEnvp'
     let flags' = gflagsToWord flags
-    ptrchild_setup <- callocBytes $ sizeOf (undefined :: FunPtr SpawnChildSetupFuncC)
+    ptrchild_setup <- callocMem :: IO (Ptr (FunPtr SpawnChildSetupFuncC))
     maybeChild_setup <- case child_setup of
         Nothing -> return (castPtrToFunPtr nullPtr)
         Just jChild_setup -> do
@@ -28980,7 +29226,7 @@
             jEnvp' <- packZeroTerminatedUTF8CArray jEnvp
             return jEnvp'
     let flags' = gflagsToWord flags
-    ptrchild_setup <- callocBytes $ sizeOf (undefined :: FunPtr SpawnChildSetupFuncC)
+    ptrchild_setup <- callocMem :: IO (Ptr (FunPtr SpawnChildSetupFuncC))
     maybeChild_setup <- case child_setup of
         Nothing -> return (castPtrToFunPtr nullPtr)
         Just jChild_setup -> do
@@ -29223,7 +29469,7 @@
             jEnvp' <- packZeroTerminatedUTF8CArray jEnvp
             return jEnvp'
     let flags' = gflagsToWord flags
-    ptrchild_setup <- callocBytes $ sizeOf (undefined :: FunPtr SpawnChildSetupFuncC)
+    ptrchild_setup <- callocMem :: IO (Ptr (FunPtr SpawnChildSetupFuncC))
     maybeChild_setup <- case child_setup of
         Nothing -> return (castPtrToFunPtr nullPtr)
         Just jChild_setup -> do
@@ -29286,6 +29532,7 @@
     dest' <- textToCString dest
     src' <- textToCString src
     result <- g_stpcpy dest' src'
+    checkUnexpectedReturnNULL "g_stpcpy" result
     result' <- cstringToText result
     freeMem result
     freeMem dest'
@@ -29475,6 +29722,7 @@
             jFrom_locale' <- textToCString jFrom_locale
             return jFrom_locale'
     result <- g_str_to_ascii str' maybeFrom_locale
+    checkUnexpectedReturnNULL "g_str_to_ascii" result
     result' <- cstringToText result
     freeMem result
     freeMem str'
@@ -29510,6 +29758,7 @@
             return jTranslit_locale'
     ascii_alternates <- allocMem :: IO (Ptr (Ptr CString))
     result <- g_str_tokenize_and_fold string' maybeTranslit_locale ascii_alternates
+    checkUnexpectedReturnNULL "g_str_tokenize_and_fold" result
     result' <- unpackZeroTerminatedUTF8CArray result
     mapZeroTerminatedCArray freeMem result
     freeMem result
@@ -29547,6 +29796,7 @@
     string' <- textToCString string
     valid_chars' <- textToCString valid_chars
     result <- g_strcanon string' valid_chars' substitutor
+    checkUnexpectedReturnNULL "g_strcanon" result
     result' <- cstringToText result
     freeMem result
     freeMem string'
@@ -29600,6 +29850,7 @@
 strchomp string = liftIO $ do
     string' <- textToCString string
     result <- g_strchomp string'
+    checkUnexpectedReturnNULL "g_strchomp" result
     result' <- cstringToText result
     freeMem result
     freeMem string'
@@ -29625,6 +29876,7 @@
 strchug string = liftIO $ do
     string' <- textToCString string
     result <- g_strchug string'
+    checkUnexpectedReturnNULL "g_strchug" result
     result' <- cstringToText result
     freeMem result
     freeMem string'
@@ -29685,6 +29937,7 @@
 strcompress source = liftIO $ do
     source' <- textToCString source
     result <- g_strcompress source'
+    checkUnexpectedReturnNULL "g_strcompress" result
     result' <- cstringToText result
     freeMem result
     freeMem source'
@@ -29719,6 +29972,7 @@
             jDelimiters' <- textToCString jDelimiters
             return jDelimiters'
     result <- g_strdelimit string' maybeDelimiters new_delimiter
+    checkUnexpectedReturnNULL "g_strdelimit" result
     result' <- cstringToText result
     freeMem result
     freeMem string'
@@ -29745,6 +29999,7 @@
 strdown string = liftIO $ do
     string' <- textToCString string
     result <- g_strdown string'
+    checkUnexpectedReturnNULL "g_strdown" result
     result' <- cstringToText result
     freeMem result
     freeMem string'
@@ -29770,6 +30025,7 @@
 strdup str = liftIO $ do
     str' <- textToCString str
     result <- g_strdup str'
+    checkUnexpectedReturnNULL "g_strdup" result
     result' <- cstringToText result
     freeMem result
     freeMem str'
@@ -29794,6 +30050,7 @@
     m T.Text
 strerror errnum = liftIO $ do
     result <- g_strerror errnum
+    checkUnexpectedReturnNULL "g_strerror" result
     result' <- cstringToText result
     return result'
 
@@ -29820,6 +30077,7 @@
     source' <- textToCString source
     exceptions' <- textToCString exceptions
     result <- g_strescape source' exceptions'
+    checkUnexpectedReturnNULL "g_strescape" result
     result' <- cstringToText result
     freeMem result
     freeMem source'
@@ -29873,6 +30131,7 @@
             jInit' <- textToCString jInit
             return jInit'
     result <- g_string_new maybeInit
+    checkUnexpectedReturnNULL "g_string_new" result
     result' <- (wrapBoxed String) result
     freeMem maybeInit
     return result'
@@ -29899,6 +30158,7 @@
 stringNewLen init len = liftIO $ do
     init' <- textToCString init
     result <- g_string_new_len init' len
+    checkUnexpectedReturnNULL "g_string_new_len" result
     result' <- (wrapBoxed String) result
     freeMem init'
     return result'
@@ -29922,6 +30182,7 @@
     m String
 stringSizedNew dfl_size = liftIO $ do
     result <- g_string_sized_new dfl_size
+    checkUnexpectedReturnNULL "g_string_sized_new" result
     result' <- (wrapBoxed String) result
     return result'
 
@@ -29948,6 +30209,7 @@
     msgid' <- textToCString msgid
     msgval' <- textToCString msgval
     result <- g_strip_context msgid' msgval'
+    checkUnexpectedReturnNULL "g_strip_context" result
     result' <- cstringToText result
     freeMem msgid'
     freeMem msgval'
@@ -29980,6 +30242,7 @@
             return jSeparator'
     str_array' <- textToCString str_array
     result <- g_strjoinv maybeSeparator str_array'
+    checkUnexpectedReturnNULL "g_strjoinv" result
     result' <- cstringToText result
     freeMem result
     freeMem maybeSeparator
@@ -30095,6 +30358,7 @@
 strndup str n = liftIO $ do
     str' <- textToCString str
     result <- g_strndup str' n
+    checkUnexpectedReturnNULL "g_strndup" result
     result' <- cstringToText result
     freeMem result
     freeMem str'
@@ -30121,6 +30385,7 @@
     m T.Text
 strnfill length_ fill_char = liftIO $ do
     result <- g_strnfill length_ fill_char
+    checkUnexpectedReturnNULL "g_strnfill" result
     result' <- cstringToText result
     freeMem result
     return result'
@@ -30145,6 +30410,7 @@
 strreverse string = liftIO $ do
     string' <- textToCString string
     result <- g_strreverse string'
+    checkUnexpectedReturnNULL "g_strreverse" result
     result' <- cstringToText result
     freeMem result
     freeMem string'
@@ -30173,6 +30439,7 @@
     haystack' <- textToCString haystack
     needle' <- textToCString needle
     result <- g_strrstr haystack' needle'
+    checkUnexpectedReturnNULL "g_strrstr" result
     result' <- cstringToText result
     freeMem result
     freeMem haystack'
@@ -30204,6 +30471,7 @@
     haystack' <- textToCString haystack
     needle' <- textToCString needle
     result <- g_strrstr_len haystack' haystack_len needle'
+    checkUnexpectedReturnNULL "g_strrstr_len" result
     result' <- cstringToText result
     freeMem result
     freeMem haystack'
@@ -30229,6 +30497,7 @@
     m T.Text
 strsignal signum = liftIO $ do
     result <- g_strsignal signum
+    checkUnexpectedReturnNULL "g_strsignal" result
     result' <- cstringToText result
     return result'
 
@@ -30257,6 +30526,7 @@
     haystack' <- textToCString haystack
     needle' <- textToCString needle
     result <- g_strstr_len haystack' haystack_len needle'
+    checkUnexpectedReturnNULL "g_strstr_len" result
     result' <- cstringToText result
     freeMem result
     freeMem haystack'
@@ -30311,6 +30581,7 @@
 strup string = liftIO $ do
     string' <- textToCString string
     result <- g_strup string'
+    checkUnexpectedReturnNULL "g_strup" result
     result' <- cstringToText result
     freeMem result
     freeMem string'
@@ -30410,7 +30681,7 @@
     m ()
 testAddDataFunc testpath test_data test_func = liftIO $ do
     testpath' <- textToCString testpath
-    ptrtest_func <- callocBytes $ sizeOf (undefined :: FunPtr TestDataFuncC)
+    ptrtest_func <- callocMem :: IO (Ptr (FunPtr TestDataFuncC))
     test_func' <- mkTestDataFunc (testDataFuncWrapper (Just ptrtest_func) test_func)
     poke ptrtest_func test_func'
     g_test_add_data_func testpath' test_data test_func'
@@ -30438,7 +30709,7 @@
     m ()
 testAddFunc testpath test_func = liftIO $ do
     testpath' <- textToCString testpath
-    ptrtest_func <- callocBytes $ sizeOf (undefined :: FunPtr TestFuncC)
+    ptrtest_func <- callocMem :: IO (Ptr (FunPtr TestFuncC))
     test_func' <- mkTestFunc (testFuncWrapper (Just ptrtest_func) test_func)
     poke ptrtest_func test_func'
     g_test_add_func testpath' test_func'
@@ -30617,6 +30888,7 @@
 testGetDir file_type = liftIO $ do
     let file_type' = (fromIntegral . fromEnum) file_type
     result <- g_test_get_dir file_type'
+    checkUnexpectedReturnNULL "g_test_get_dir" result
     result' <- cstringToText result
     return result'
 
@@ -30667,6 +30939,7 @@
 testLogTypeName log_type = liftIO $ do
     let log_type' = (fromIntegral . fromEnum) log_type
     result <- g_test_log_type_name log_type'
+    checkUnexpectedReturnNULL "g_test_log_type_name" result
     result' <- cstringToText result
     return result'
 
@@ -30690,7 +30963,7 @@
     Ptr () ->                               -- destroy_data
     m ()
 testQueueDestroy destroy_func destroy_data = liftIO $ do
-    ptrdestroy_func <- callocBytes $ sizeOf (undefined :: FunPtr DestroyNotifyC)
+    ptrdestroy_func <- callocMem :: IO (Ptr (FunPtr DestroyNotifyC))
     destroy_func' <- mkDestroyNotify (destroyNotifyWrapper (Just ptrdestroy_func) destroy_func)
     poke ptrdestroy_func destroy_func'
     g_test_queue_destroy destroy_func' destroy_data
@@ -31283,6 +31556,7 @@
     m Thread
 threadSelf  = liftIO $ do
     result <- g_thread_self
+    checkUnexpectedReturnNULL "g_thread_self" result
     result' <- (wrapBoxed Thread) result
     return result'
 
@@ -31411,6 +31685,7 @@
     m Source
 timeoutSourceNew interval = liftIO $ do
     result <- g_timeout_source_new interval
+    checkUnexpectedReturnNULL "g_timeout_source_new" result
     result' <- (wrapBoxed Source) result
     return result'
 
@@ -31433,6 +31708,7 @@
     m Source
 timeoutSourceNewSeconds interval = liftIO $ do
     result <- g_timeout_source_new_seconds interval
+    checkUnexpectedReturnNULL "g_timeout_source_new_seconds" result
     result' <- (wrapBoxed Source) result
     return result'
 
@@ -32379,6 +32655,7 @@
 unixFdSourceNew fd condition = liftIO $ do
     let condition' = gflagsToWord condition
     result <- g_unix_fd_source_new fd condition'
+    checkUnexpectedReturnNULL "g_unix_fd_source_new" result
     result' <- (wrapBoxed Source) result
     return result'
 
@@ -32488,6 +32765,7 @@
     m Source
 unixSignalSourceNew signum = liftIO $ do
     result <- g_unix_signal_source_new signum
+    checkUnexpectedReturnNULL "g_unix_signal_source_new" result
     result' <- (wrapBoxed Source) result
     return result'
 
@@ -32567,6 +32845,7 @@
             return jReserved_chars_allowed'
     let allow_utf8' = (fromIntegral . fromEnum) allow_utf8
     result <- g_uri_escape_string unescaped' maybeReserved_chars_allowed allow_utf8'
+    checkUnexpectedReturnNULL "g_uri_escape_string" result
     result' <- cstringToText result
     freeMem result
     freeMem unescaped'
@@ -32593,6 +32872,7 @@
 uriListExtractUris uri_list = liftIO $ do
     uri_list' <- textToCString uri_list
     result <- g_uri_list_extract_uris uri_list'
+    checkUnexpectedReturnNULL "g_uri_list_extract_uris" result
     result' <- unpackZeroTerminatedUTF8CArray result
     mapZeroTerminatedCArray freeMem result
     freeMem result
@@ -32619,6 +32899,7 @@
 uriParseScheme uri = liftIO $ do
     uri' <- textToCString uri
     result <- g_uri_parse_scheme uri'
+    checkUnexpectedReturnNULL "g_uri_parse_scheme" result
     result' <- cstringToText result
     freeMem result
     freeMem uri'
@@ -32662,6 +32943,7 @@
             jIllegal_characters' <- textToCString jIllegal_characters
             return jIllegal_characters'
     result <- g_uri_unescape_segment maybeEscaped_string maybeEscaped_string_end maybeIllegal_characters
+    checkUnexpectedReturnNULL "g_uri_unescape_segment" result
     result' <- cstringToText result
     freeMem result
     freeMem maybeEscaped_string
@@ -32696,6 +32978,7 @@
             jIllegal_characters' <- textToCString jIllegal_characters
             return jIllegal_characters'
     result <- g_uri_unescape_string escaped_string' maybeIllegal_characters
+    checkUnexpectedReturnNULL "g_uri_unescape_string" result
     result' <- cstringToText result
     freeMem result
     freeMem escaped_string'
@@ -32745,6 +33028,7 @@
 utf8Casefold str len = liftIO $ do
     str' <- textToCString str
     result <- g_utf8_casefold str' len
+    checkUnexpectedReturnNULL "g_utf8_casefold" result
     result' <- cstringToText result
     freeMem result
     freeMem str'
@@ -32799,6 +33083,7 @@
 utf8CollateKey str len = liftIO $ do
     str' <- textToCString str
     result <- g_utf8_collate_key str' len
+    checkUnexpectedReturnNULL "g_utf8_collate_key" result
     result' <- cstringToText result
     freeMem result
     freeMem str'
@@ -32826,6 +33111,7 @@
 utf8CollateKeyForFilename str len = liftIO $ do
     str' <- textToCString str
     result <- g_utf8_collate_key_for_filename str' len
+    checkUnexpectedReturnNULL "g_utf8_collate_key_for_filename" result
     result' <- cstringToText result
     freeMem result
     freeMem str'
@@ -32854,6 +33140,7 @@
     p' <- textToCString p
     end' <- textToCString end
     result <- g_utf8_find_next_char p' end'
+    checkUnexpectedReturnNULL "g_utf8_find_next_char" result
     result' <- cstringToText result
     freeMem result
     freeMem p'
@@ -32883,6 +33170,7 @@
     str' <- textToCString str
     p' <- textToCString p
     result <- g_utf8_find_prev_char str' p'
+    checkUnexpectedReturnNULL "g_utf8_find_prev_char" result
     result' <- cstringToText result
     freeMem result
     freeMem str'
@@ -32964,6 +33252,7 @@
     str' <- textToCString str
     let mode' = (fromIntegral . fromEnum) mode
     result <- g_utf8_normalize str' len mode'
+    checkUnexpectedReturnNULL "g_utf8_normalize" result
     result' <- cstringToText result
     freeMem result
     freeMem str'
@@ -32991,6 +33280,7 @@
 utf8OffsetToPointer str offset = liftIO $ do
     str' <- textToCString str
     result <- g_utf8_offset_to_pointer str' offset
+    checkUnexpectedReturnNULL "g_utf8_offset_to_pointer" result
     result' <- cstringToText result
     freeMem result
     freeMem str'
@@ -33043,6 +33333,7 @@
 utf8PrevChar p = liftIO $ do
     p' <- textToCString p
     result <- g_utf8_prev_char p'
+    checkUnexpectedReturnNULL "g_utf8_prev_char" result
     result' <- cstringToText result
     freeMem result
     freeMem p'
@@ -33073,6 +33364,7 @@
     p' <- textToCString p
     let c' = (fromIntegral . ord) c
     result <- g_utf8_strchr p' len c'
+    checkUnexpectedReturnNULL "g_utf8_strchr" result
     result' <- cstringToText result
     freeMem result
     freeMem p'
@@ -33100,6 +33392,7 @@
 utf8Strdown str len = liftIO $ do
     str' <- textToCString str
     result <- g_utf8_strdown str' len
+    checkUnexpectedReturnNULL "g_utf8_strdown" result
     result' <- cstringToText result
     freeMem result
     freeMem str'
@@ -33155,6 +33448,7 @@
     dest' <- textToCString dest
     src' <- textToCString src
     result <- g_utf8_strncpy dest' src' n
+    checkUnexpectedReturnNULL "g_utf8_strncpy" result
     result' <- cstringToText result
     freeMem result
     freeMem dest'
@@ -33186,6 +33480,7 @@
     p' <- textToCString p
     let c' = (fromIntegral . ord) c
     result <- g_utf8_strrchr p' len c'
+    checkUnexpectedReturnNULL "g_utf8_strrchr" result
     result' <- cstringToText result
     freeMem result
     freeMem p'
@@ -33213,6 +33508,7 @@
 utf8Strreverse str len = liftIO $ do
     str' <- textToCString str
     result <- g_utf8_strreverse str' len
+    checkUnexpectedReturnNULL "g_utf8_strreverse" result
     result' <- cstringToText result
     freeMem result
     freeMem str'
@@ -33240,6 +33536,7 @@
 utf8Strup str len = liftIO $ do
     str' <- textToCString str
     result <- g_utf8_strup str' len
+    checkUnexpectedReturnNULL "g_utf8_strup" result
     result' <- cstringToText result
     freeMem result
     freeMem str'
@@ -33269,6 +33566,7 @@
 utf8Substring str start_pos end_pos = liftIO $ do
     str' <- textToCString str
     result <- g_utf8_substring str' start_pos end_pos
+    checkUnexpectedReturnNULL "g_utf8_substring" result
     result' <- cstringToText result
     freeMem result
     freeMem str'
@@ -33416,6 +33714,7 @@
             return jEndptr'
     onException (do
         result <- propagateGError $ g_variant_parse maybeType_ text' maybeLimit maybeEndptr
+        checkUnexpectedReturnNULL "g_variant_parse" result
         result' <- wrapGVariantPtr result
         whenJust type_ touchManagedPtr
         freeMem text'
@@ -33451,6 +33750,7 @@
     let error_' = unsafeManagedPtrGetPtr error_
     source_str' <- textToCString source_str
     result <- g_variant_parse_error_print_context error_' source_str'
+    checkUnexpectedReturnNULL "g_variant_parse_error_print_context" result
     result' <- cstringToText result
     freeMem result
     touchManagedPtr error_
@@ -33515,6 +33815,7 @@
 variantTypeChecked_ arg0 = liftIO $ do
     arg0' <- textToCString arg0
     result <- g_variant_type_checked_ arg0'
+    checkUnexpectedReturnNULL "g_variant_type_checked_" result
     result' <- (newBoxed VariantType) result
     freeMem arg0'
     return result'
diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -454,49 +454,3 @@
 FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
 DAMAGES.
-
-                     END OF TERMS AND CONDITIONS
-
-           How to Apply These Terms to Your New Libraries
-
-  If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change.  You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
-  To apply these terms, attach the following notices to the library.  It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the library's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the
-  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
-  <signature of Ty Coon>, 1 April 1990
-  Ty Coon, President of Vice
-
-That's all there is to it!
diff --git a/gi-glib.cabal b/gi-glib.cabal
--- a/gi-glib.cabal
+++ b/gi-glib.cabal
@@ -1,6 +1,6 @@
 -- Autogenerated, do not edit.
 name:               gi-glib
-version:            0.2.44.9
+version:            0.2.44.10
 synopsis:           GLib bindings
 description:        Bindings for GLib, autogenerated by haskell-gi.
 homepage:           https://github.com/haskell-gi/haskell-gi
@@ -16,8 +16,8 @@
     default-language:   Haskell2010
     exposed-modules:    GI.GLib, GI.GLibAttributes, GI.GLibSignals
     pkgconfig-depends:  glib-2.0 >= 2.44
-    build-depends: base >= 4.6 && <4.9,
-        haskell-gi-base >= 0.9 && < 1,
+    build-depends: base >= 4.7 && <5,
+        haskell-gi-base >= 0.10 && < 1,
         bytestring >= 0.10,
         containers >= 0.5,
         text >= 1.0,
