Correctly serialize events

Change-Id: If8bf7cbf7f94d2437f41b21c6fe9098e856cec43