Fixes incorrect cast