revise event related code