fix proiority logic