Updated some tests, fixed some bugs.