Added auto-reconnect on certain errors, also fixed disconnect method so it is possible to reconnect