Fix deprecated function fatal error