Sync with 2.5.1
Apply gh-1663