Fix issue #9724 and #9738