Reinstated invalid tests, and fixed bugs