Fix typo that caused run-time error on certain conditions