fix bug in event update
refactoring, cleanup