Revert "Remove unnecessary casts" + add missing casts