update res and code