fix typecasting