Add event tests and fix a bug they found