fix typo

Fix typo introduced in #634, and fix unit tests.