fix bugs in tests