fix cast error