add some fixes, fix tests