make event handler optional, add a test