sync with the patch contributed to ASF