Fix priority sorting
Added event priority test