fixed a bug with script getting confused by folders with the same substring