fix cast bug