Fixes #6622 increase counter
Fixes #6622 removed unused casting