Fix issue with number of iterations
Fix various issues