Revert "remove useless cast"

This reverts commit 980c527de96b61c006e722d5293b25239e28c749.