fixed, properly handle log of 0