finish fixing tests and bugs