Fixed connection issue, error handling