fix port typecasting issue