Fix bugs found with the API rework.