tests, and corresponding bug fixes