More bug fixes and some comments on the tests