Fixed a couple of issues with corner cases (e.g., continuous events).