Fix bugs in tests
Merge origin/master