add test_event_saving and
fix bugs exposed by tests