Fix deprecated function calls