Fix indexing error for global writeback