Fix type cast error