replace compare with tables, and fix typo err