Fix a couple of logic errors.