Fixed event priority handling and fixed parsing end events.