various code cleanups (bug #4353)