Fixed error on disconnect

Fixes #26
Merge pull request #48 from Xandaros/patch-1

Fixed error on disconnect. Winning