missing tests, bug fixes