Tests: Fix bugs in tests