fix bug in the resource scanner when folder name is empty
fix infinite loop in "repair orphan scope" method