Fix issue #9652 and #9651