Fixing some bugs in unit tests.