add condition to prevent processing twice