Scope and fix loop