Fixed bug that could cause connection to close prematurely (gotham backport)

Fixed bug that could cause connection to close prematurely.

Fixed an segmentation fault in case of exiting XBMC.

Corrected version number