Fixed rebuild loop