- safe checking for null pointers in events params
- added debug argument