Check for res before using it.