fix bug in loop