fixed bug in callbacks. changed event* to shared_ptr<event>