Fixed various problems in tests