Fixes #6622 removed unused casting