fix tests and add some tests for metrics