Fixed errors in metric testing code