more minor bug fixes and tests