fix infinite loop possibility when files have been moved back to themselves