Fix deprecated api calls and warnings