Fix gobject_ref assertion