Added error after each iteration