fix tests and code that broken them