fixed add result in loop