Small bugfixes in .js code
Fix bug in #reconnect() when disconnected.
Merge pull request #167 from jtomaszewski/master

Small bugfixes in .js code