Fix infinate file loop in prod

#6571