Get event ordering right while generating PHP screenshot