Fixing various problems with tests