Fixes #4310: code cleanup