Fix using deprecated functions