Bug fixes: the original sock_cmp_port doesn't match its description in the book