various test fixes and improvements
Merge pull request #2664 from sebv/master

Various test fixes and improvements