Replace some calls to deprecated functions