fix arduino logic