Fix bugs

There were bugs in tests.