Many improvements in tests