fix tests and cleanup issues