Added correct error detection in server response