clean up API and bug fix in sending Event message