Fix scala tests
Fix division by zero errors in the metrics