Fix GI matrix generation.