add tests, fix last