various test fixes and improvements