issue #5814: fix bugs