fix bad for loop for multiple packages