fixed logic error with dealing with filename parts