Fix runtime errors