Fixed error handling on initial connection.