fix index G in grad