Fix deprecated events api