fixed logic for dirty hack