Squashed some bugs related to port range lookup and network masks.