fix typo and improve tests