event order bug fix