remove unused defines and logic (issue #5058)