some tests, bug fixes