fix typo and fix condition to find prefix