various cleanups (issue #6389)