Fixed issue with buffer function messing up event order