Fixed all the tests failing because of #472, and fixed other tests as well

As it says on the tin!