Removed unnecessary cast in legacy/unused code