Fix GValue error and unref unused buffers