additional tests and related bug fixes