Fix bug

Add else statement that prevents priority inversion.