More bug fixes and added error handling for the client