fixed logic in pathname