fixed bug removing elements from list while iterating on the list ; use os.path.join