Fixed broken error check.