added support of anonymous functions for events