Fixed bug in loop