Fix runtime errors caused by recent changes