fixed logic error:rearrange dir