fix typecasting issue