fix typo in error and deduplicate