fix gradients, add iterations