fix for root function