Fix incorrect cast