Fixed a number of testing bugs