added metrics test cases, fixed one bug