Fixed order of error checking in client