fix wrong if statement

+---------------+------+
| Q             | A    |
| ---           | ---  |
| Bug fix?      | y    |
| New feature?  | n    |
| BC breaks?    | n    |
| Deprecations? | n    |
| Tests pass?   | y    |
| Fixed tickets | none |
| License       | MIT  |
| Doc PR        |      |
+---------------+------+