a few test fixes, and one bugfix