Bugfixes for libmetrics

Hi, 

thanks for the great software. I tested it on a couple of our data sets and I have these two suggested fixes for libmetrics.py.

Let me know what you think.

Ole