added new error handling in client