add tests, fix some errors