Do more casting to avoid build errors