fix cast problem