fix bug in delegateEvents