Added error handling on disconnection.
Added sys.
Merge pull request #4 from brian-zhao-bex/error-handle

Error handle