* fix all the bugs appearing in the tests