Fixed several bugs

There was an issue with check_packet_address which involved using
logical operators instead of bitwise.