UPNP bug fix and general source code improvements.