add if statement to prevent adding rootpath multiple times