Added some connection error handling