change order of grad update