Fixing some bugs in the tests