add events and debug