Fix builds without legacy enabled