Bug fix, fix tests