Fix 1 bug and 2 warnings in event module, found by valgrind