Fixed a bunch of buggy unit tests