add condition to prevent for processing twice