add tests and fix others