Use rval to prevent value from changing for error result.