Fixed several event bugs. More test coverage.