improve rootfolder detection