Fix typo that leads to logical error