fixed gradient updates