Correct some mistakes so unittests pass