issue #4437: fix some bugs.