Fix most of the unit tests