tests, bug fixes