fix tests and some bugs