Fixed bugs in tests