fixed missing range in for loop