new tests and bug fixes