issue #3935 Fix some bugs.