result right, but still buggy when return value to R